Copyright | (C) Hécate Moonlight 2022 |
---|---|
License | BSD-3-Clause |
Maintainer | The Haskell Cryptography Group |
Portability | GHC only |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Synopsis
- data PublicKey
- data SecretKey
- data SignedMessage
- generateKeyPair :: IO (PublicKey, SecretKey)
- signMessage :: StrictByteString -> SecretKey -> IO SignedMessage
- openMessage :: SignedMessage -> PublicKey -> Maybe StrictByteString
- getSignature :: SignedMessage -> StrictByteString
- unsafeGetMessage :: SignedMessage -> StrictByteString
- mkSignature :: StrictByteString -> StrictByteString -> SignedMessage
Introduction
Public-key Signatures work with a SecretKey
and PublicKey
- The
SecretKey
is used to append a signature to any number of messages. It must stay private; - The
PublicKey
is used by third-parties to to verify that the signature appended to a message was issued by the creator of the public key. It must be distributed to third-parties.
Verifiers need to already know and ultimately trust a public key before messages signed using it can be verified.
Since: 0.0.1.0
Since: 0.0.1.0
data SignedMessage Source #
Since: 0.0.1.0
Instances
Eq SignedMessage Source # | Since: 0.0.1.0 |
Defined in Sel.PublicKey.Signature (==) :: SignedMessage -> SignedMessage -> Bool # (/=) :: SignedMessage -> SignedMessage -> Bool # | |
Ord SignedMessage Source # | Since: 0.0.1.0 |
Defined in Sel.PublicKey.Signature compare :: SignedMessage -> SignedMessage -> Ordering # (<) :: SignedMessage -> SignedMessage -> Bool # (<=) :: SignedMessage -> SignedMessage -> Bool # (>) :: SignedMessage -> SignedMessage -> Bool # (>=) :: SignedMessage -> SignedMessage -> Bool # max :: SignedMessage -> SignedMessage -> SignedMessage # min :: SignedMessage -> SignedMessage -> SignedMessage # |
Key Pair generation
generateKeyPair :: IO (PublicKey, SecretKey) Source #
Generate a pair of public and secret key.
The length parameters used are cryptoSignPublicKeyBytes
and cryptoSignSecretKeyBytes
.
Since: 0.0.1.0
Message Signing
signMessage :: StrictByteString -> SecretKey -> IO SignedMessage Source #
Sign a message.
Since: 0.0.1.0
openMessage :: SignedMessage -> PublicKey -> Maybe StrictByteString Source #
Open a signed message with the signatory's public key.
The function returns Nothing
if there is a key mismatch.
Since: 0.0.1.0
Constructing and Deconstructing
getSignature :: SignedMessage -> StrictByteString Source #
Get the signature part of a SignedMessage
.
Since: 0.0.1.0
unsafeGetMessage :: SignedMessage -> StrictByteString Source #
Get the message part of a SignedMessage
without verifying the signature.
Since: 0.0.1.0
mkSignature :: StrictByteString -> StrictByteString -> SignedMessage Source #
Combine a message and a signature into a SignedMessage
.
Since: 0.0.1.0