Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Abstract digital signatures.
Synopsis
- class (Typeable v, Show (VerKeyDSIGN v), Eq (VerKeyDSIGN v), Show (SignKeyDSIGN v), Show (SigDSIGN v), Eq (SigDSIGN v), NoThunks (SigDSIGN v), NoThunks (SignKeyDSIGN v), NoThunks (VerKeyDSIGN v), KnownNat (SeedSizeDSIGN v), KnownNat (SizeVerKeyDSIGN v), KnownNat (SizeSignKeyDSIGN v), KnownNat (SizeSigDSIGN v)) ⇒ DSIGNAlgorithm v where
- type SeedSizeDSIGN v ∷ Nat
- type SizeVerKeyDSIGN v ∷ Nat
- type SizeSignKeyDSIGN v ∷ Nat
- type SizeSigDSIGN v ∷ Nat
- data VerKeyDSIGN v ∷ Type
- data SignKeyDSIGN v ∷ Type
- data SigDSIGN v ∷ Type
- type ContextDSIGN v ∷ Type
- type Signable v ∷ Type → Constraint
- algorithmNameDSIGN ∷ proxy v → String
- deriveVerKeyDSIGN ∷ SignKeyDSIGN v → VerKeyDSIGN v
- hashVerKeyDSIGN ∷ HashAlgorithm h ⇒ VerKeyDSIGN v → Hash h (VerKeyDSIGN v)
- signDSIGN ∷ (Signable v a, HasCallStack) ⇒ ContextDSIGN v → a → SignKeyDSIGN v → SigDSIGN v
- verifyDSIGN ∷ (Signable v a, HasCallStack) ⇒ ContextDSIGN v → VerKeyDSIGN v → a → SigDSIGN v → Either String ()
- genKeyDSIGN ∷ Seed → SignKeyDSIGN v
- rawSerialiseVerKeyDSIGN ∷ VerKeyDSIGN v → ByteString
- rawSerialiseSignKeyDSIGN ∷ SignKeyDSIGN v → ByteString
- rawSerialiseSigDSIGN ∷ SigDSIGN v → ByteString
- rawDeserialiseVerKeyDSIGN ∷ ByteString → Maybe (VerKeyDSIGN v)
- rawDeserialiseSignKeyDSIGN ∷ ByteString → Maybe (SignKeyDSIGN v)
- rawDeserialiseSigDSIGN ∷ ByteString → Maybe (SigDSIGN v)
- data Seed
- seedSizeDSIGN ∷ ∀ v proxy. DSIGNAlgorithm v ⇒ proxy v → Word
- sizeVerKeyDSIGN ∷ ∀ v proxy. DSIGNAlgorithm v ⇒ proxy v → Word
- sizeSignKeyDSIGN ∷ ∀ v proxy. DSIGNAlgorithm v ⇒ proxy v → Word
- sizeSigDSIGN ∷ ∀ v proxy. DSIGNAlgorithm v ⇒ proxy v → Word
- class (DSIGNAlgorithm v, NoThunks (SignKeyDSIGNM v)) ⇒ DSIGNMAlgorithm v where
- data SignKeyDSIGNM v ∷ Type
- deriveVerKeyDSIGNM ∷ (MonadThrow m, MonadST m) ⇒ SignKeyDSIGNM v → m (VerKeyDSIGN v)
- signDSIGNM ∷ (Signable v a, MonadST m, MonadThrow m) ⇒ ContextDSIGN v → a → SignKeyDSIGNM v → m (SigDSIGN v)
- genKeyDSIGNMWith ∷ (MonadST m, MonadThrow m) ⇒ MLockedAllocator m → MLockedSeed (SeedSizeDSIGN v) → m (SignKeyDSIGNM v)
- cloneKeyDSIGNMWith ∷ MonadST m ⇒ MLockedAllocator m → SignKeyDSIGNM v → m (SignKeyDSIGNM v)
- getSeedDSIGNMWith ∷ (MonadST m, MonadThrow m) ⇒ MLockedAllocator m → Proxy v → SignKeyDSIGNM v → m (MLockedSeed (SeedSizeDSIGN v))
- forgetSignKeyDSIGNMWith ∷ (MonadST m, MonadThrow m) ⇒ MLockedAllocator m → SignKeyDSIGNM v → m ()
- genKeyDSIGNM ∷ (DSIGNMAlgorithm v, MonadST m, MonadThrow m) ⇒ MLockedSeed (SeedSizeDSIGN v) → m (SignKeyDSIGNM v)
- cloneKeyDSIGNM ∷ (DSIGNMAlgorithm v, MonadST m) ⇒ SignKeyDSIGNM v → m (SignKeyDSIGNM v)
- getSeedDSIGNM ∷ (DSIGNMAlgorithm v, MonadST m, MonadThrow m) ⇒ Proxy v → SignKeyDSIGNM v → m (MLockedSeed (SeedSizeDSIGN v))
- forgetSignKeyDSIGNM ∷ (DSIGNMAlgorithm v, MonadST m, MonadThrow m) ⇒ SignKeyDSIGNM v → m ()
- newtype SignedDSIGN v a = SignedDSIGN (SigDSIGN v)
- signedDSIGN ∷ (DSIGNAlgorithm v, Signable v a) ⇒ ContextDSIGN v → a → SignKeyDSIGN v → SignedDSIGN v a
- verifySignedDSIGN ∷ (DSIGNAlgorithm v, Signable v a, HasCallStack) ⇒ ContextDSIGN v → VerKeyDSIGN v → a → SignedDSIGN v a → Either String ()
- encodeVerKeyDSIGN ∷ DSIGNAlgorithm v ⇒ VerKeyDSIGN v → Encoding
- decodeVerKeyDSIGN ∷ ∀ v s. DSIGNAlgorithm v ⇒ Decoder s (VerKeyDSIGN v)
- encodeSignKeyDSIGN ∷ DSIGNAlgorithm v ⇒ SignKeyDSIGN v → Encoding
- decodeSignKeyDSIGN ∷ ∀ v s. DSIGNAlgorithm v ⇒ Decoder s (SignKeyDSIGN v)
- encodeSigDSIGN ∷ DSIGNAlgorithm v ⇒ SigDSIGN v → Encoding
- decodeSigDSIGN ∷ ∀ v s. DSIGNAlgorithm v ⇒ Decoder s (SigDSIGN v)
- encodeSignedDSIGN ∷ DSIGNAlgorithm v ⇒ SignedDSIGN v a → Encoding
- decodeSignedDSIGN ∷ DSIGNAlgorithm v ⇒ Decoder s (SignedDSIGN v a)
- encodedVerKeyDSIGNSizeExpr ∷ ∀ v. DSIGNAlgorithm v ⇒ Proxy (VerKeyDSIGN v) → Size
- encodedSignKeyDSIGNSizeExpr ∷ ∀ v. DSIGNAlgorithm v ⇒ Proxy (SignKeyDSIGN v) → Size
- encodedSigDSIGNSizeExpr ∷ ∀ v. DSIGNAlgorithm v ⇒ Proxy (SigDSIGN v) → Size
- failSizeCheck ∷ MonadFail m ⇒ String → String → ByteString → Word → m a
- class DSIGNMAlgorithm v ⇒ UnsoundDSIGNMAlgorithm v where
- rawSerialiseSignKeyDSIGNM ∷ (MonadST m, MonadThrow m) ⇒ SignKeyDSIGNM v → m ByteString
- rawDeserialiseSignKeyDSIGNMWith ∷ (MonadST m, MonadThrow m) ⇒ MLockedAllocator m → ByteString → m (Maybe (SignKeyDSIGNM v))
- encodeSignKeyDSIGNM ∷ (UnsoundDSIGNMAlgorithm v, MonadST m, MonadThrow m) ⇒ SignKeyDSIGNM v → m Encoding
- decodeSignKeyDSIGNM ∷ ∀ m v s. (UnsoundDSIGNMAlgorithm v, MonadST m, MonadThrow m) ⇒ Decoder s (m (SignKeyDSIGNM v))
- rawDeserialiseSignKeyDSIGNM ∷ (UnsoundDSIGNMAlgorithm v, MonadST m, MonadThrow m) ⇒ ByteString → m (Maybe (SignKeyDSIGNM v))
DSIGN algorithm class
class (Typeable v, Show (VerKeyDSIGN v), Eq (VerKeyDSIGN v), Show (SignKeyDSIGN v), Show (SigDSIGN v), Eq (SigDSIGN v), NoThunks (SigDSIGN v), NoThunks (SignKeyDSIGN v), NoThunks (VerKeyDSIGN v), KnownNat (SeedSizeDSIGN v), KnownNat (SizeVerKeyDSIGN v), KnownNat (SizeSignKeyDSIGN v), KnownNat (SizeSigDSIGN v)) ⇒ DSIGNAlgorithm v where Source #
The pure DSIGN API, which supports the full set of DSIGN operations, but does not allow for secure forgetting of private keys.
algorithmNameDSIGN, deriveVerKeyDSIGN, signDSIGN, verifyDSIGN, genKeyDSIGN, rawSerialiseVerKeyDSIGN, rawSerialiseSignKeyDSIGN, rawSerialiseSigDSIGN, rawDeserialiseVerKeyDSIGN, rawDeserialiseSignKeyDSIGN, rawDeserialiseSigDSIGN
type SeedSizeDSIGN v ∷ Nat Source #
type SizeVerKeyDSIGN v ∷ Nat Source #
type SizeSignKeyDSIGN v ∷ Nat Source #
type SizeSigDSIGN v ∷ Nat Source #
data VerKeyDSIGN v ∷ Type Source #
data SignKeyDSIGN v ∷ Type Source #
data SigDSIGN v ∷ Type Source #
type ContextDSIGN v ∷ Type Source #
Context required to run the DSIGN algorithm
Unit by default (no context required)
type ContextDSIGN v = ()
type Signable v ∷ Type → Constraint Source #
algorithmNameDSIGN ∷ proxy v → String Source #
deriveVerKeyDSIGN ∷ SignKeyDSIGN v → VerKeyDSIGN v Source #
hashVerKeyDSIGN ∷ HashAlgorithm h ⇒ VerKeyDSIGN v → Hash h (VerKeyDSIGN v) Source #
signDSIGN ∷ (Signable v a, HasCallStack) ⇒ ContextDSIGN v → a → SignKeyDSIGN v → SigDSIGN v Source #
verifyDSIGN ∷ (Signable v a, HasCallStack) ⇒ ContextDSIGN v → VerKeyDSIGN v → a → SigDSIGN v → Either String () Source #
genKeyDSIGN ∷ Seed → SignKeyDSIGN v Source #
Note that this function may error (with SeedBytesExhausted
) if the
provided seed is not long enough. Callers should ensure that the seed has
is at least seedSizeDSIGN
bytes long.
rawSerialiseVerKeyDSIGN ∷ VerKeyDSIGN v → ByteString Source #
rawSerialiseSignKeyDSIGN ∷ SignKeyDSIGN v → ByteString Source #
rawSerialiseSigDSIGN ∷ SigDSIGN v → ByteString Source #
rawDeserialiseVerKeyDSIGN ∷ ByteString → Maybe (VerKeyDSIGN v) Source #
rawDeserialiseSignKeyDSIGN ∷ ByteString → Maybe (SignKeyDSIGN v) Source #
rawDeserialiseSigDSIGN ∷ ByteString → Maybe (SigDSIGN v) Source #
Instances
A seed contains a finite number of bytes, and is used for seeding cryptographic algorithms including key generation.
This is not itself a PRNG, but can be used to seed a PRNG.
seedSizeDSIGN ∷ ∀ v proxy. DSIGNAlgorithm v ⇒ proxy v → Word Source #
The upper bound on the Seed
size needed by genKeyDSIGN
sizeVerKeyDSIGN ∷ ∀ v proxy. DSIGNAlgorithm v ⇒ proxy v → Word Source #
sizeSignKeyDSIGN ∷ ∀ v proxy. DSIGNAlgorithm v ⇒ proxy v → Word Source #
sizeSigDSIGN ∷ ∀ v proxy. DSIGNAlgorithm v ⇒ proxy v → Word Source #
MLocked DSIGN algorithm class
class (DSIGNAlgorithm v, NoThunks (SignKeyDSIGNM v)) ⇒ DSIGNMAlgorithm v where Source #
data SignKeyDSIGNM v ∷ Type Source #
deriveVerKeyDSIGNM ∷ (MonadThrow m, MonadST m) ⇒ SignKeyDSIGNM v → m (VerKeyDSIGN v) Source #
signDSIGNM ∷ (Signable v a, MonadST m, MonadThrow m) ⇒ ContextDSIGN v → a → SignKeyDSIGNM v → m (SigDSIGN v) Source #
genKeyDSIGNMWith ∷ (MonadST m, MonadThrow m) ⇒ MLockedAllocator m → MLockedSeed (SeedSizeDSIGN v) → m (SignKeyDSIGNM v) Source #
cloneKeyDSIGNMWith ∷ MonadST m ⇒ MLockedAllocator m → SignKeyDSIGNM v → m (SignKeyDSIGNM v) Source #
getSeedDSIGNMWith ∷ (MonadST m, MonadThrow m) ⇒ MLockedAllocator m → Proxy v → SignKeyDSIGNM v → m (MLockedSeed (SeedSizeDSIGN v)) Source #
forgetSignKeyDSIGNMWith ∷ (MonadST m, MonadThrow m) ⇒ MLockedAllocator m → SignKeyDSIGNM v → m () Source #
Instances
DSIGNMAlgorithm Ed25519DSIGN Source # | |
Defined in Cardano.Crypto.DSIGN.Ed25519 data SignKeyDSIGNM Ed25519DSIGN Source # deriveVerKeyDSIGNM ∷ (MonadThrow m, MonadST m) ⇒ SignKeyDSIGNM Ed25519DSIGN → m (VerKeyDSIGN Ed25519DSIGN) Source # signDSIGNM ∷ (Signable Ed25519DSIGN a, MonadST m, MonadThrow m) ⇒ ContextDSIGN Ed25519DSIGN → a → SignKeyDSIGNM Ed25519DSIGN → m (SigDSIGN Ed25519DSIGN) Source # genKeyDSIGNMWith ∷ (MonadST m, MonadThrow m) ⇒ MLockedAllocator m → MLockedSeed (SeedSizeDSIGN Ed25519DSIGN) → m (SignKeyDSIGNM Ed25519DSIGN) Source # cloneKeyDSIGNMWith ∷ MonadST m ⇒ MLockedAllocator m → SignKeyDSIGNM Ed25519DSIGN → m (SignKeyDSIGNM Ed25519DSIGN) Source # getSeedDSIGNMWith ∷ (MonadST m, MonadThrow m) ⇒ MLockedAllocator m → Proxy Ed25519DSIGN → SignKeyDSIGNM Ed25519DSIGN → m (MLockedSeed (SeedSizeDSIGN Ed25519DSIGN)) Source # forgetSignKeyDSIGNMWith ∷ (MonadST m, MonadThrow m) ⇒ MLockedAllocator m → SignKeyDSIGNM Ed25519DSIGN → m () Source # |
genKeyDSIGNM ∷ (DSIGNMAlgorithm v, MonadST m, MonadThrow m) ⇒ MLockedSeed (SeedSizeDSIGN v) → m (SignKeyDSIGNM v) Source #
cloneKeyDSIGNM ∷ (DSIGNMAlgorithm v, MonadST m) ⇒ SignKeyDSIGNM v → m (SignKeyDSIGNM v) Source #
getSeedDSIGNM ∷ (DSIGNMAlgorithm v, MonadST m, MonadThrow m) ⇒ Proxy v → SignKeyDSIGNM v → m (MLockedSeed (SeedSizeDSIGN v)) Source #
forgetSignKeyDSIGNM ∷ (DSIGNMAlgorithm v, MonadST m, MonadThrow m) ⇒ SignKeyDSIGNM v → m () Source #
SignedDSIGN
wrapper
newtype SignedDSIGN v a Source #
SignedDSIGN (SigDSIGN v) |
Instances
signedDSIGN ∷ (DSIGNAlgorithm v, Signable v a) ⇒ ContextDSIGN v → a → SignKeyDSIGN v → SignedDSIGN v a Source #
verifySignedDSIGN ∷ (DSIGNAlgorithm v, Signable v a, HasCallStack) ⇒ ContextDSIGN v → VerKeyDSIGN v → a → SignedDSIGN v a → Either String () Source #
CBOR encoding and decoding
encodeVerKeyDSIGN ∷ DSIGNAlgorithm v ⇒ VerKeyDSIGN v → Encoding Source #
decodeVerKeyDSIGN ∷ ∀ v s. DSIGNAlgorithm v ⇒ Decoder s (VerKeyDSIGN v) Source #
encodeSignKeyDSIGN ∷ DSIGNAlgorithm v ⇒ SignKeyDSIGN v → Encoding Source #
decodeSignKeyDSIGN ∷ ∀ v s. DSIGNAlgorithm v ⇒ Decoder s (SignKeyDSIGN v) Source #
encodeSigDSIGN ∷ DSIGNAlgorithm v ⇒ SigDSIGN v → Encoding Source #
decodeSigDSIGN ∷ ∀ v s. DSIGNAlgorithm v ⇒ Decoder s (SigDSIGN v) Source #
encodeSignedDSIGN ∷ DSIGNAlgorithm v ⇒ SignedDSIGN v a → Encoding Source #
decodeSignedDSIGN ∷ DSIGNAlgorithm v ⇒ Decoder s (SignedDSIGN v a) Source #
Encoded Size
expresssions
encodedVerKeyDSIGNSizeExpr ∷ ∀ v. DSIGNAlgorithm v ⇒ Proxy (VerKeyDSIGN v) → Size Source #
Size
expression for VerKeyDSIGN
which is using sizeVerKeyDSIGN
encoded as Size
.
encodedSignKeyDSIGNSizeExpr ∷ ∀ v. DSIGNAlgorithm v ⇒ Proxy (SignKeyDSIGN v) → Size Source #
Size
expression for SignKeyDSIGN
which is using sizeSignKeyDSIGN
encoded as Size
.
encodedSigDSIGNSizeExpr ∷ ∀ v. DSIGNAlgorithm v ⇒ Proxy (SigDSIGN v) → Size Source #
Size
expression for SigDSIGN
which is using sizeSigDSIGN
encoded as
Size
.
Helper
failSizeCheck ∷ MonadFail m ⇒ String → String → ByteString → Word → m a Source #
Helper function that always fails, but it provides a different message whenever expected size does not match.
Unsound CBOR encoding and decoding of MLocked DSIGN keys
class DSIGNMAlgorithm v ⇒ UnsoundDSIGNMAlgorithm v where Source #
Unsound operations on DSIGNM sign keys. These operations violate secure
forgetting constraints by leaking secrets to unprotected memory. Consider
using the DirectSerialise
/ DirectDeserialise
APIs instead.
rawSerialiseSignKeyDSIGNM ∷ (MonadST m, MonadThrow m) ⇒ SignKeyDSIGNM v → m ByteString Source #
rawDeserialiseSignKeyDSIGNMWith ∷ (MonadST m, MonadThrow m) ⇒ MLockedAllocator m → ByteString → m (Maybe (SignKeyDSIGNM v)) Source #
Instances
UnsoundDSIGNMAlgorithm Ed25519DSIGN Source # | |
Defined in Cardano.Crypto.DSIGN.Ed25519 rawSerialiseSignKeyDSIGNM ∷ (MonadST m, MonadThrow m) ⇒ SignKeyDSIGNM Ed25519DSIGN → m ByteString Source # rawDeserialiseSignKeyDSIGNMWith ∷ (MonadST m, MonadThrow m) ⇒ MLockedAllocator m → ByteString → m (Maybe (SignKeyDSIGNM Ed25519DSIGN)) Source # |
encodeSignKeyDSIGNM ∷ (UnsoundDSIGNMAlgorithm v, MonadST m, MonadThrow m) ⇒ SignKeyDSIGNM v → m Encoding Source #
decodeSignKeyDSIGNM ∷ ∀ m v s. (UnsoundDSIGNMAlgorithm v, MonadST m, MonadThrow m) ⇒ Decoder s (m (SignKeyDSIGNM v)) Source #
rawDeserialiseSignKeyDSIGNM ∷ (UnsoundDSIGNMAlgorithm v, MonadST m, MonadThrow m) ⇒ ByteString → m (Maybe (SignKeyDSIGNM v)) Source #