HORIZON HASKELLDocslts/ghc-10.0.x8174fa42026-10-11Search names, modules, packages, or :: a typeCtrl K

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 8174fa4 · 2026-10-11

Modulecrypton-2.1.7Haskell2010

Crypto.PubKey.ECDSA

Elliptic Curve Digital Signature Algorithm, with the parameterized curve implementations provided by module Crypto.ECC.

Public/private key pairs can be generated using curveGenerateKeyPair or decoded from binary.

WARNING: Only curve P-256 has constant-time implementation. Signature operations with P-384 and P-521 may leak the private key.

Signature verification should be safe for all curves.

  • 3 types
  • 1 class
  • 16 values
  • Packagecrypton-2.1.7
  • Exports20
  • LanguageHaskell2010
  • LicenceBSD-3-Clause AND MIT AND ISC
  • SourceECDSA.hs
classclass EllipticCurveBasepointArith curve => EllipticCurveECDSA curve where
#

Elliptic curves with ECDSA capabilities.

Methods

Instances3EllipticCurveECDSA

Public keys

4 declarations

Private keys

3 declarations

Signatures

3 declarations

Generation and verification

6 declarations

Deterministic nonces

3 declarations
valuedeterministicNonce
  1. :: (EllipticCurveECDSA curve, HashAlgorithm hashDRG, HashAlgorithm hashDigest)
  2. => proxy curve
  3. -> hashDRG
  4. -> PrivateKey curve
  5. -> Digest hashDigest
  6. -> Scalar curve -> Maybe a
  7. -> a
#

Truncate a digest based on curve order size. | Deterministic nonce generation according to RFC 6979.

The nonce is derived from the private key and the message alone, so a signature made this way needs no random number generator and cannot be the one that repeats a nonce -- which, for ECDSA, hands over the private key.

The hash used to seed the generator is given separately from the one the message was digested with, as RFC 6979 allows.

The last argument is what to do with a candidate nonce. It may answer Nothing, in which case another candidate is drawn, which is what signDigestDeterministic does for the r or s that comes out zero:

deterministicNonce prx SHA256 priv digest (\k -> signDigestWith prx k priv digest)