Safe Haskell | None |
---|---|
Language | Haskell2010 |
WARNING: Signature operations may leak the private key. Signature verification should be safe.
- data Signature = Signature {}
- type PublicPoint = Point
- data PublicKey = PublicKey {}
- type PrivateNumber = Integer
- data PrivateKey = PrivateKey {}
- data KeyPair = KeyPair Curve PublicPoint PrivateNumber
- toPublicKey :: KeyPair -> PublicKey
- toPrivateKey :: KeyPair -> PrivateKey
- signWith :: (ByteArrayAccess msg, HashAlgorithm hash) => Integer -> PrivateKey -> hash -> msg -> Maybe Signature
- sign :: (ByteArrayAccess msg, HashAlgorithm hash, MonadRandom m) => PrivateKey -> hash -> msg -> m Signature
- verify :: (ByteArrayAccess msg, HashAlgorithm hash) => hash -> PublicKey -> Signature -> msg -> Bool
Documentation
Represent a ECDSA signature namely R and S.
type PublicPoint = Point Source #
ECC Public Point
ECDSA Public Key.
type PrivateNumber = Integer Source #
ECC Private Number
data PrivateKey Source #
ECDSA Private Key.
ECDSA Key Pair.
toPublicKey :: KeyPair -> PublicKey Source #
Public key of a ECDSA Key pair.
toPrivateKey :: KeyPair -> PrivateKey Source #
Private key of a ECDSA Key pair.
:: (ByteArrayAccess msg, HashAlgorithm hash) | |
=> Integer | k random number |
-> PrivateKey | private key |
-> hash | hash function |
-> msg | message to sign |
-> Maybe Signature |
Sign message using the private key and an explicit k number.
WARNING: Vulnerable to timing attacks.
sign :: (ByteArrayAccess msg, HashAlgorithm hash, MonadRandom m) => PrivateKey -> hash -> msg -> m Signature Source #
Sign message using the private key.
WARNING: Vulnerable to timing attacks.
verify :: (ByteArrayAccess msg, HashAlgorithm hash) => hash -> PublicKey -> Signature -> msg -> Bool Source #
Verify a bytestring using the public key.