Safe Haskell | None |
---|---|
Language | Haskell2010 |
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
- 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.
P256 secret cryptographic key.
P256 cryptographic signature.
detSecretKey :: ByteString -> SecretKey Source #
Deterministicaly generate a secret key from seed.
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.