paseto-0.1.1.1: Platform-Agnostic Security Tokens
Safe HaskellSafe-Inferred
LanguageHaskell2010

Crypto.Paseto.Keys.V3

Description

P384 ECDSA cryptographic keys.

Synopsis

Curve

curveP384 :: Curve Source #

Elliptic curve SEC_p384r1.

Private key

data PrivateKeyP384 where Source #

ECDSA private key for curve SEC_p384r1.

Note that this type's Eq instance performs a constant-time equality check.

Bundled Patterns

pattern PrivateKeyP384 :: PrivateKey -> PrivateKeyP384 

Instances

Instances details
Show PrivateKeyP384 Source # 
Instance details

Defined in Crypto.Paseto.Keys.V3

Eq PrivateKeyP384 Source # 
Instance details

Defined in Crypto.Paseto.Keys.V3

mkPrivateKeyP384 :: PrivateKey -> Maybe PrivateKeyP384 Source #

Construct a private key for curve SEC_p384r1.

generatePrivateKeyP384 :: IO PrivateKeyP384 Source #

Generate a private key for curve SEC_p384r1.

encodePrivateKeyP384 :: PrivateKeyP384 -> ScrubbedBytes Source #

Encode a private key into its binary format as defined in RFC 5915, i.e. the privateKey field described in section 3.

data ScalarDecodingError Source #

Error decoding a scalar value.

Constructors

ScalarDecodingInvalidLengthError

Invalid scalar length.

Fields

  • !Int

    Expected length

  • !Int

    Actual length

ScalarDecodingInvalidError

Decoded scalar is invalid for the curve.

decodePrivateKeyP384 :: ScrubbedBytes -> Either ScalarDecodingError PrivateKeyP384 Source #

Decode a private key from its binary format as defined in RFC 5915, i.e. the privateKey field described in section 3.

Helpers

generateScalarP384 :: IO Integer Source #

Generate a random scalar on the curve SEC_p384r1.

isScalarValidP384 :: Integer -> Bool Source #

Whether a scalar is valid on the curve SEC_p384r1.

Public key

data PublicKeyP384 where Source #

ECDSA public key for curve SEC_p384r1.

Bundled Patterns

pattern PublicKeyP384 :: PublicKey -> PublicKeyP384 

Instances

Instances details
Show PublicKeyP384 Source # 
Instance details

Defined in Crypto.Paseto.Keys.V3

Eq PublicKeyP384 Source # 
Instance details

Defined in Crypto.Paseto.Keys.V3

mkPublicKeyP384 :: PublicKey -> Maybe PublicKeyP384 Source #

Construct a public key for curve SEC_p384r1.

fromPrivateKeyP384 :: PrivateKeyP384 -> PublicKeyP384 Source #

Construct the PublicKeyP384 which corresponds to a given PrivateKeyP384.

encodePublicKeyP384 :: PublicKeyP384 -> ByteString Source #

Encode an elliptic curve point into its compressed binary format as defined by SEC 1 and RFC 5480 section 2.2.

data CompressedPointDecodingError Source #

Error decoding a compressed elliptic curve point.

Constructors

CompressedPointDecodingInvalidPrefixError

Prefix is not either of the expected values (0x02 or 0x03).

Fields

  • !Word8

    Invalid prefix which was encountered.

CompressedPointDecodingInvalidLengthError

Length of the provided compressed point is invalid.

Fields

  • !Int

    Expected length

  • !Int

    Actual length

CompressedPointDecodingModularSquareRootError

Failed to find the modular square root of a value.

CompressedPointDecodingInvalidPointError !Point

Point is invalid for the curve.

data UncompressedPointDecodingError Source #

Error decoding an uncompressed elliptic curve point.

Constructors

UncompressedPointDecodingInvalidPrefixError

Prefix is not the expected value (0x04).

Fields

  • !Word8

    Invalid prefix which was encountered.

UncompressedPointDecodingInvalidLengthError

Length of the provided point is invalid.

Fields

  • !Int

    Expected length

  • !Int

    Actual length

UncompressedPointDecodingInvalidPointError !Point

Point is invalid for the curve.

decodePublicKeyP384 :: ByteString -> Either PublicKeyP384DecodingError PublicKeyP384 Source #

Decode a public key from either its compressed or uncompressed binary format as defined by SEC 1 and RFC 5480 section 2.2.