| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Tezos.Crypto.P256
Description
P256 cryptographic primitives.
This module is mostly a stub, it doesn't implement actual crypto. TODO (#18) implement crypto properly.
Synopsis
- newtype PublicKey = PublicKey {}
- data SecretKey
- newtype Signature = Signature {}
- detSecretKey :: ByteString -> SecretKey
- toPublic :: SecretKey -> PublicKey
- genPublicKey :: MonadGen m => m PublicKey
- genSecretKey :: MonadGen m => m SecretKey
- genSignature :: MonadGen m => m Signature
- publicKeyToBytes :: forall ba. ByteArray ba => PublicKey -> ba
- mkPublicKey :: ByteArrayAccess ba => ba -> Either CryptoParseError PublicKey
- publicKeyLengthBytes :: Integral n => n
- signatureToBytes :: ByteArray ba => Signature -> ba
- mkSignature :: ByteArray ba => ba -> Either CryptoParseError Signature
- signatureLengthBytes :: Integral n => n
- formatPublicKey :: PublicKey -> Text
- mformatPublicKey :: PublicKey -> MText
- parsePublicKey :: Text -> Either CryptoParseError PublicKey
- formatSignature :: Signature -> Text
- mformatSignature :: Signature -> MText
- parseSignature :: Text -> Either CryptoParseError Signature
- checkSignature :: PublicKey -> Signature -> ByteString -> Bool
Cryptographic primitive types
P256 public cryptographic key.
Constructors
| PublicKey | |
Fields | |
Instances
| Eq PublicKey Source # | |
| Show PublicKey Source # | |
| Generic PublicKey Source # | |
| Arbitrary PublicKey Source # | |
| NFData PublicKey Source # | |
Defined in Tezos.Crypto.P256 | |
| Buildable PublicKey Source # | |
Defined in Tezos.Crypto.P256 | |
| type Rep PublicKey Source # | |
Defined in Tezos.Crypto.P256 type Rep PublicKey = D1 ('MetaData "PublicKey" "Tezos.Crypto.P256" "morley-1.4.0-FPgS4VJ0cLmB07ubDf4i8P" 'True) (C1 ('MetaCons "PublicKey" 'PrefixI 'True) (S1 ('MetaSel ('Just "unPublicKey") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ByteString))) | |
P256 secret cryptographic key.
Instances
| Eq SecretKey Source # | |
| Show SecretKey Source # | |
| Generic SecretKey Source # | |
| Arbitrary SecretKey Source # | |
| NFData SecretKey Source # | |
Defined in Tezos.Crypto.P256 | |
| type Rep SecretKey Source # | |
Defined in Tezos.Crypto.P256 type Rep SecretKey = D1 ('MetaData "SecretKey" "Tezos.Crypto.P256" "morley-1.4.0-FPgS4VJ0cLmB07ubDf4i8P" 'True) (C1 ('MetaCons "SecretKey" 'PrefixI 'True) (S1 ('MetaSel ('Just "unSecretKey") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ByteString))) | |
P256 cryptographic signature.
Constructors
| Signature | |
Fields | |
Instances
| Eq Signature Source # | |
| Show Signature Source # | |
| Generic Signature Source # | |
| Arbitrary Signature Source # | |
| NFData Signature Source # | |
Defined in Tezos.Crypto.P256 | |
| Buildable Signature Source # | |
Defined in Tezos.Crypto.P256 | |
| type Rep Signature Source # | |
Defined in Tezos.Crypto.P256 type Rep Signature = D1 ('MetaData "Signature" "Tezos.Crypto.P256" "morley-1.4.0-FPgS4VJ0cLmB07ubDf4i8P" 'True) (C1 ('MetaCons "Signature" 'PrefixI 'True) (S1 ('MetaSel ('Just "unSignature") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ByteString))) | |
detSecretKey :: ByteString -> SecretKey Source #
Deterministicaly generate a secret key from seed.
Generators
genPublicKey :: MonadGen m => m PublicKey Source #
genSecretKey :: MonadGen m => m SecretKey Source #
genSignature :: MonadGen m => m Signature Source #
Raw bytes (no checksums, tags or anything)
publicKeyToBytes :: forall ba. ByteArray ba => PublicKey -> ba Source #
Convert a PublicKey to raw bytes.
TODO (#18): implement properly.
mkPublicKey :: ByteArrayAccess ba => ba -> Either CryptoParseError PublicKey Source #
Make a PublicKey from raw bytes.
TODO (#18): implement properly.
publicKeyLengthBytes :: Integral n => n Source #
signatureToBytes :: ByteArray ba => Signature -> ba Source #
Convert a PublicKey to raw bytes.
TODO (#18): implement properly.
mkSignature :: ByteArray ba => ba -> Either CryptoParseError Signature Source #
Make a Signature from raw bytes.
TODO (#18): implement properly.
signatureLengthBytes :: Integral n => n Source #
Formatting and parsing
formatPublicKey :: PublicKey -> Text Source #
mformatPublicKey :: PublicKey -> MText Source #
formatSignature :: Signature -> Text Source #
mformatSignature :: Signature -> MText Source #
Signing
checkSignature :: PublicKey -> Signature -> ByteString -> Bool Source #
Check that a sequence of bytes has been signed with a given key.