Safe Haskell | None |
---|---|
Language | Haskell2010 |
Cryptographic Algorithms for Keys.
Synopsis
- class AsPublicKey k where
- asPublicKey :: Getter k (Maybe k)
- data Crv
- data ECKeyParameters
- ecCrv :: Getter ECKeyParameters Crv
- ecX :: Getter ECKeyParameters SizedBase64Integer
- ecY :: Getter ECKeyParameters SizedBase64Integer
- ecD :: Getter ECKeyParameters (Maybe SizedBase64Integer)
- curve :: Crv -> Curve
- point :: ECKeyParameters -> Point
- ecPrivateKey :: (MonadError e m, AsError e) => ECKeyParameters -> m Integer
- ecParametersFromX509 :: PubKeyEC -> Maybe ECKeyParameters
- data RSAPrivateKeyOthElem = RSAPrivateKeyOthElem {}
- data RSAPrivateKeyOptionalParameters = RSAPrivateKeyOptionalParameters {}
- data RSAPrivateKeyParameters = RSAPrivateKeyParameters {}
- data RSAKeyParameters = RSAKeyParameters Base64Integer Base64Integer (Maybe RSAPrivateKeyParameters)
- toRSAKeyParameters :: PrivateKey -> RSAKeyParameters
- toRSAPublicKeyParameters :: PublicKey -> RSAKeyParameters
- rsaE :: Lens' RSAKeyParameters Base64Integer
- rsaN :: Lens' RSAKeyParameters Base64Integer
- rsaPrivateKeyParameters :: Lens' RSAKeyParameters (Maybe RSAPrivateKeyParameters)
- rsaPublicKey :: RSAKeyParameters -> PublicKey
- genRSA :: MonadRandom m => Int -> m RSAKeyParameters
- newtype OctKeyParameters = OctKeyParameters Base64Octets
- octK :: Iso' OctKeyParameters Base64Octets
- data OKPKeyParameters
- data OKPCrv
- data KeyMaterialGenParam
- data KeyMaterial
- genKeyMaterial :: MonadRandom m => KeyMaterialGenParam -> m KeyMaterial
- sign :: (MonadRandom m, MonadError e m, AsError e) => Alg -> KeyMaterial -> ByteString -> m ByteString
- verify :: (MonadError e m, AsError e) => Alg -> KeyMaterial -> ByteString -> ByteString -> m Bool
- module Crypto.Random
Type classes
class AsPublicKey k where Source #
Keys that may have have public material
asPublicKey :: Getter k (Maybe k) Source #
Get the public key
Instances
AsPublicKey RSAKeyParameters Source # | |
Defined in Crypto.JOSE.JWA.JWK | |
AsPublicKey ECKeyParameters Source # | |
Defined in Crypto.JOSE.JWA.JWK | |
AsPublicKey KeyMaterial Source # | |
Defined in Crypto.JOSE.JWA.JWK | |
AsPublicKey OKPKeyParameters Source # | |
Defined in Crypto.JOSE.JWA.JWK | |
AsPublicKey JWK Source # | |
Defined in Crypto.JOSE.JWK |
Parameters for Elliptic Curve Keys
"crv" (Curve) Parameter
data ECKeyParameters Source #
Parameters for Elliptic Curve Keys
Instances
Eq ECKeyParameters Source # | |
Defined in Crypto.JOSE.JWA.JWK (==) :: ECKeyParameters -> ECKeyParameters -> Bool # (/=) :: ECKeyParameters -> ECKeyParameters -> Bool # | |
Show ECKeyParameters Source # | |
Defined in Crypto.JOSE.JWA.JWK showsPrec :: Int -> ECKeyParameters -> ShowS # show :: ECKeyParameters -> String # showList :: [ECKeyParameters] -> ShowS # | |
Arbitrary ECKeyParameters Source # | |
Defined in Crypto.JOSE.JWA.JWK arbitrary :: Gen ECKeyParameters # shrink :: ECKeyParameters -> [ECKeyParameters] # | |
ToJSON ECKeyParameters Source # | |
Defined in Crypto.JOSE.JWA.JWK toJSON :: ECKeyParameters -> Value # toEncoding :: ECKeyParameters -> Encoding # toJSONList :: [ECKeyParameters] -> Value # toEncodingList :: [ECKeyParameters] -> Encoding # | |
FromJSON ECKeyParameters Source # | |
Defined in Crypto.JOSE.JWA.JWK parseJSON :: Value -> Parser ECKeyParameters # parseJSONList :: Value -> Parser [ECKeyParameters] # | |
AsPublicKey ECKeyParameters Source # | |
Defined in Crypto.JOSE.JWA.JWK |
point :: ECKeyParameters -> Point Source #
ecPrivateKey :: (MonadError e m, AsError e) => ECKeyParameters -> m Integer Source #
Parameters for RSA Keys
data RSAPrivateKeyOthElem Source #
"oth" (Other Primes Info) Parameter
Instances
Eq RSAPrivateKeyOthElem Source # | |
Defined in Crypto.JOSE.JWA.JWK (==) :: RSAPrivateKeyOthElem -> RSAPrivateKeyOthElem -> Bool # (/=) :: RSAPrivateKeyOthElem -> RSAPrivateKeyOthElem -> Bool # | |
Show RSAPrivateKeyOthElem Source # | |
Defined in Crypto.JOSE.JWA.JWK showsPrec :: Int -> RSAPrivateKeyOthElem -> ShowS # show :: RSAPrivateKeyOthElem -> String # showList :: [RSAPrivateKeyOthElem] -> ShowS # | |
Arbitrary RSAPrivateKeyOthElem Source # | |
Defined in Crypto.JOSE.JWA.JWK | |
ToJSON RSAPrivateKeyOthElem Source # | |
Defined in Crypto.JOSE.JWA.JWK toJSON :: RSAPrivateKeyOthElem -> Value # toEncoding :: RSAPrivateKeyOthElem -> Encoding # toJSONList :: [RSAPrivateKeyOthElem] -> Value # toEncodingList :: [RSAPrivateKeyOthElem] -> Encoding # | |
FromJSON RSAPrivateKeyOthElem Source # | |
Defined in Crypto.JOSE.JWA.JWK parseJSON :: Value -> Parser RSAPrivateKeyOthElem # parseJSONList :: Value -> Parser [RSAPrivateKeyOthElem] # |
data RSAPrivateKeyOptionalParameters Source #
Optional parameters for RSA private keys
RSAPrivateKeyOptionalParameters | |
|
Instances
data RSAPrivateKeyParameters Source #
RSA private key parameters
Instances
Eq RSAPrivateKeyParameters Source # | |
Defined in Crypto.JOSE.JWA.JWK | |
Show RSAPrivateKeyParameters Source # | |
Defined in Crypto.JOSE.JWA.JWK showsPrec :: Int -> RSAPrivateKeyParameters -> ShowS # show :: RSAPrivateKeyParameters -> String # showList :: [RSAPrivateKeyParameters] -> ShowS # | |
Arbitrary RSAPrivateKeyParameters Source # | |
Defined in Crypto.JOSE.JWA.JWK | |
ToJSON RSAPrivateKeyParameters Source # | |
Defined in Crypto.JOSE.JWA.JWK | |
FromJSON RSAPrivateKeyParameters Source # | |
Defined in Crypto.JOSE.JWA.JWK |
data RSAKeyParameters Source #
Parameters for RSA Keys
Instances
Eq RSAKeyParameters Source # | |
Defined in Crypto.JOSE.JWA.JWK (==) :: RSAKeyParameters -> RSAKeyParameters -> Bool # (/=) :: RSAKeyParameters -> RSAKeyParameters -> Bool # | |
Show RSAKeyParameters Source # | |
Defined in Crypto.JOSE.JWA.JWK showsPrec :: Int -> RSAKeyParameters -> ShowS # show :: RSAKeyParameters -> String # showList :: [RSAKeyParameters] -> ShowS # | |
Arbitrary RSAKeyParameters Source # | |
Defined in Crypto.JOSE.JWA.JWK arbitrary :: Gen RSAKeyParameters # shrink :: RSAKeyParameters -> [RSAKeyParameters] # | |
ToJSON RSAKeyParameters Source # | |
Defined in Crypto.JOSE.JWA.JWK toJSON :: RSAKeyParameters -> Value # toEncoding :: RSAKeyParameters -> Encoding # toJSONList :: [RSAKeyParameters] -> Value # toEncodingList :: [RSAKeyParameters] -> Encoding # | |
FromJSON RSAKeyParameters Source # | |
Defined in Crypto.JOSE.JWA.JWK parseJSON :: Value -> Parser RSAKeyParameters # parseJSONList :: Value -> Parser [RSAKeyParameters] # | |
AsPublicKey RSAKeyParameters Source # | |
Defined in Crypto.JOSE.JWA.JWK |
genRSA :: MonadRandom m => Int -> m RSAKeyParameters Source #
Parameters for Symmetric Keys
newtype OctKeyParameters Source #
Symmetric key parameters data.
Instances
Eq OctKeyParameters Source # | |
Defined in Crypto.JOSE.JWA.JWK (==) :: OctKeyParameters -> OctKeyParameters -> Bool # (/=) :: OctKeyParameters -> OctKeyParameters -> Bool # | |
Show OctKeyParameters Source # | |
Defined in Crypto.JOSE.JWA.JWK showsPrec :: Int -> OctKeyParameters -> ShowS # show :: OctKeyParameters -> String # showList :: [OctKeyParameters] -> ShowS # | |
Arbitrary OctKeyParameters Source # | |
Defined in Crypto.JOSE.JWA.JWK arbitrary :: Gen OctKeyParameters # shrink :: OctKeyParameters -> [OctKeyParameters] # | |
ToJSON OctKeyParameters Source # | |
Defined in Crypto.JOSE.JWA.JWK toJSON :: OctKeyParameters -> Value # toEncoding :: OctKeyParameters -> Encoding # toJSONList :: [OctKeyParameters] -> Value # toEncodingList :: [OctKeyParameters] -> Encoding # | |
FromJSON OctKeyParameters Source # | |
Defined in Crypto.JOSE.JWA.JWK parseJSON :: Value -> Parser OctKeyParameters # parseJSONList :: Value -> Parser [OctKeyParameters] # |
Parameters for CFRG EC keys (RFC 8037)
data OKPKeyParameters Source #
Instances
Eq OKPKeyParameters Source # | |
Defined in Crypto.JOSE.JWA.JWK (==) :: OKPKeyParameters -> OKPKeyParameters -> Bool # (/=) :: OKPKeyParameters -> OKPKeyParameters -> Bool # | |
Show OKPKeyParameters Source # | |
Defined in Crypto.JOSE.JWA.JWK showsPrec :: Int -> OKPKeyParameters -> ShowS # show :: OKPKeyParameters -> String # showList :: [OKPKeyParameters] -> ShowS # | |
Arbitrary OKPKeyParameters Source # | |
Defined in Crypto.JOSE.JWA.JWK arbitrary :: Gen OKPKeyParameters # shrink :: OKPKeyParameters -> [OKPKeyParameters] # | |
ToJSON OKPKeyParameters Source # | |
Defined in Crypto.JOSE.JWA.JWK toJSON :: OKPKeyParameters -> Value # toEncoding :: OKPKeyParameters -> Encoding # toJSONList :: [OKPKeyParameters] -> Value # toEncodingList :: [OKPKeyParameters] -> Encoding # | |
FromJSON OKPKeyParameters Source # | |
Defined in Crypto.JOSE.JWA.JWK parseJSON :: Value -> Parser OKPKeyParameters # parseJSONList :: Value -> Parser [OKPKeyParameters] # | |
AsPublicKey OKPKeyParameters Source # | |
Defined in Crypto.JOSE.JWA.JWK |
Key generation
data KeyMaterialGenParam Source #
Keygen parameters.
ECGenParam Crv | Generate an EC key with specified curve. |
RSAGenParam Int | Generate an RSA key with specified size in bytes. |
OctGenParam Int | Generate a symmetric key with specified size in bytes. |
OKPGenParam OKPCrv | Generate an EdDSA or Edwards ECDH key with specified curve. |
Instances
Eq KeyMaterialGenParam Source # | |
Defined in Crypto.JOSE.JWA.JWK (==) :: KeyMaterialGenParam -> KeyMaterialGenParam -> Bool # (/=) :: KeyMaterialGenParam -> KeyMaterialGenParam -> Bool # | |
Show KeyMaterialGenParam Source # | |
Defined in Crypto.JOSE.JWA.JWK showsPrec :: Int -> KeyMaterialGenParam -> ShowS # show :: KeyMaterialGenParam -> String # showList :: [KeyMaterialGenParam] -> ShowS # | |
Arbitrary KeyMaterialGenParam Source # | |
Defined in Crypto.JOSE.JWA.JWK |
data KeyMaterial Source #
Key material sum type.
ECKeyMaterial ECKeyParameters | |
RSAKeyMaterial RSAKeyParameters | |
OctKeyMaterial OctKeyParameters | |
OKPKeyMaterial OKPKeyParameters |
Instances
Eq KeyMaterial Source # | |
Defined in Crypto.JOSE.JWA.JWK (==) :: KeyMaterial -> KeyMaterial -> Bool # (/=) :: KeyMaterial -> KeyMaterial -> Bool # | |
Show KeyMaterial Source # | |
Defined in Crypto.JOSE.JWA.JWK showsPrec :: Int -> KeyMaterial -> ShowS # show :: KeyMaterial -> String # showList :: [KeyMaterial] -> ShowS # | |
Arbitrary KeyMaterial Source # | |
Defined in Crypto.JOSE.JWA.JWK arbitrary :: Gen KeyMaterial # shrink :: KeyMaterial -> [KeyMaterial] # | |
ToJSON KeyMaterial Source # | |
Defined in Crypto.JOSE.JWA.JWK toJSON :: KeyMaterial -> Value # toEncoding :: KeyMaterial -> Encoding # toJSONList :: [KeyMaterial] -> Value # toEncodingList :: [KeyMaterial] -> Encoding # | |
FromJSON KeyMaterial Source # | |
Defined in Crypto.JOSE.JWA.JWK parseJSON :: Value -> Parser KeyMaterial # parseJSONList :: Value -> Parser [KeyMaterial] # | |
AsPublicKey KeyMaterial Source # | |
Defined in Crypto.JOSE.JWA.JWK |
genKeyMaterial :: MonadRandom m => KeyMaterialGenParam -> m KeyMaterial Source #
Signing and verification
sign :: (MonadRandom m, MonadError e m, AsError e) => Alg -> KeyMaterial -> ByteString -> m ByteString Source #
verify :: (MonadError e m, AsError e) => Alg -> KeyMaterial -> ByteString -> ByteString -> m Bool Source #
module Crypto.Random