Safe Haskell | Safe-Inferred |
---|---|
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 :: (MonadError e m, AsError e) => PubKeyEC -> m ECKeyParameters
- genEC :: MonadRandom m => Crv -> m 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
- genOKP :: MonadRandom m => OKPCrv -> m OKPKeyParameters
- 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 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 RSAKeyParameters 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
FromJSON ECKeyParameters Source # | |
Defined in Crypto.JOSE.JWA.JWK parseJSON :: Value -> Parser ECKeyParameters # parseJSONList :: Value -> Parser [ECKeyParameters] # | |
ToJSON ECKeyParameters Source # | |
Defined in Crypto.JOSE.JWA.JWK toJSON :: ECKeyParameters -> Value # toEncoding :: ECKeyParameters -> Encoding # toJSONList :: [ECKeyParameters] -> Value # toEncodingList :: [ECKeyParameters] -> Encoding # | |
Show ECKeyParameters Source # | |
Defined in Crypto.JOSE.JWA.JWK showsPrec :: Int -> ECKeyParameters -> ShowS # show :: ECKeyParameters -> String # showList :: [ECKeyParameters] -> ShowS # | |
Eq ECKeyParameters Source # | |
Defined in Crypto.JOSE.JWA.JWK (==) :: ECKeyParameters -> ECKeyParameters -> Bool # (/=) :: ECKeyParameters -> ECKeyParameters -> Bool # | |
AsPublicKey ECKeyParameters Source # | |
Defined in Crypto.JOSE.JWA.JWK |
point :: ECKeyParameters -> Point Source #
ecPrivateKey :: (MonadError e m, AsError e) => ECKeyParameters -> m Integer Source #
ecParametersFromX509 :: (MonadError e m, AsError e) => PubKeyEC -> m ECKeyParameters Source #
genEC :: MonadRandom m => Crv -> m ECKeyParameters Source #
Parameters for RSA Keys
data RSAPrivateKeyOthElem Source #
"oth" (Other Primes Info) Parameter
Instances
FromJSON RSAPrivateKeyOthElem Source # | |
Defined in Crypto.JOSE.JWA.JWK parseJSON :: Value -> Parser RSAPrivateKeyOthElem # parseJSONList :: Value -> Parser [RSAPrivateKeyOthElem] # | |
ToJSON RSAPrivateKeyOthElem Source # | |
Defined in Crypto.JOSE.JWA.JWK toJSON :: RSAPrivateKeyOthElem -> Value # toEncoding :: RSAPrivateKeyOthElem -> Encoding # toJSONList :: [RSAPrivateKeyOthElem] -> Value # toEncodingList :: [RSAPrivateKeyOthElem] -> Encoding # | |
Show RSAPrivateKeyOthElem Source # | |
Defined in Crypto.JOSE.JWA.JWK showsPrec :: Int -> RSAPrivateKeyOthElem -> ShowS # show :: RSAPrivateKeyOthElem -> String # showList :: [RSAPrivateKeyOthElem] -> ShowS # | |
Eq RSAPrivateKeyOthElem Source # | |
Defined in Crypto.JOSE.JWA.JWK (==) :: RSAPrivateKeyOthElem -> RSAPrivateKeyOthElem -> Bool # (/=) :: RSAPrivateKeyOthElem -> RSAPrivateKeyOthElem -> Bool # |
data RSAPrivateKeyOptionalParameters Source #
Optional parameters for RSA private keys
RSAPrivateKeyOptionalParameters | |
|
data RSAPrivateKeyParameters Source #
RSA private key parameters
Instances
FromJSON RSAPrivateKeyParameters Source # | |
Defined in Crypto.JOSE.JWA.JWK | |
ToJSON 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 # | |
Eq RSAPrivateKeyParameters Source # | |
Defined in Crypto.JOSE.JWA.JWK |
data RSAKeyParameters Source #
Parameters for RSA Keys
Instances
FromJSON RSAKeyParameters Source # | |
Defined in Crypto.JOSE.JWA.JWK parseJSON :: Value -> Parser RSAKeyParameters # parseJSONList :: Value -> Parser [RSAKeyParameters] # | |
ToJSON RSAKeyParameters Source # | |
Defined in Crypto.JOSE.JWA.JWK toJSON :: RSAKeyParameters -> Value # toEncoding :: RSAKeyParameters -> Encoding # toJSONList :: [RSAKeyParameters] -> Value # toEncodingList :: [RSAKeyParameters] -> Encoding # | |
Show RSAKeyParameters Source # | |
Defined in Crypto.JOSE.JWA.JWK showsPrec :: Int -> RSAKeyParameters -> ShowS # show :: RSAKeyParameters -> String # showList :: [RSAKeyParameters] -> ShowS # | |
Eq RSAKeyParameters Source # | |
Defined in Crypto.JOSE.JWA.JWK (==) :: RSAKeyParameters -> RSAKeyParameters -> Bool # (/=) :: RSAKeyParameters -> RSAKeyParameters -> Bool # | |
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
FromJSON OctKeyParameters Source # | |
Defined in Crypto.JOSE.JWA.JWK parseJSON :: Value -> Parser OctKeyParameters # parseJSONList :: Value -> Parser [OctKeyParameters] # | |
ToJSON OctKeyParameters Source # | |
Defined in Crypto.JOSE.JWA.JWK toJSON :: OctKeyParameters -> Value # toEncoding :: OctKeyParameters -> Encoding # toJSONList :: [OctKeyParameters] -> Value # toEncodingList :: [OctKeyParameters] -> Encoding # | |
Show OctKeyParameters Source # | |
Defined in Crypto.JOSE.JWA.JWK showsPrec :: Int -> OctKeyParameters -> ShowS # show :: OctKeyParameters -> String # showList :: [OctKeyParameters] -> ShowS # | |
Eq OctKeyParameters Source # | |
Defined in Crypto.JOSE.JWA.JWK (==) :: OctKeyParameters -> OctKeyParameters -> Bool # (/=) :: OctKeyParameters -> OctKeyParameters -> Bool # |
Parameters for CFRG EC keys (RFC 8037)
data OKPKeyParameters Source #
Ed25519Key PublicKey (Maybe SecretKey) | |
Ed448Key PublicKey (Maybe SecretKey) | |
X25519Key PublicKey (Maybe SecretKey) | |
X448Key PublicKey (Maybe SecretKey) |
Instances
FromJSON OKPKeyParameters Source # | |
Defined in Crypto.JOSE.JWA.JWK parseJSON :: Value -> Parser OKPKeyParameters # parseJSONList :: Value -> Parser [OKPKeyParameters] # | |
ToJSON OKPKeyParameters Source # | |
Defined in Crypto.JOSE.JWA.JWK toJSON :: OKPKeyParameters -> Value # toEncoding :: OKPKeyParameters -> Encoding # toJSONList :: [OKPKeyParameters] -> Value # toEncodingList :: [OKPKeyParameters] -> Encoding # | |
Show OKPKeyParameters Source # | |
Defined in Crypto.JOSE.JWA.JWK showsPrec :: Int -> OKPKeyParameters -> ShowS # show :: OKPKeyParameters -> String # showList :: [OKPKeyParameters] -> ShowS # | |
Eq OKPKeyParameters Source # | |
Defined in Crypto.JOSE.JWA.JWK (==) :: OKPKeyParameters -> OKPKeyParameters -> Bool # (/=) :: OKPKeyParameters -> OKPKeyParameters -> Bool # | |
AsPublicKey OKPKeyParameters Source # | |
Defined in Crypto.JOSE.JWA.JWK |
genOKP :: MonadRandom m => OKPCrv -> m OKPKeyParameters Source #
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
Show KeyMaterialGenParam Source # | |
Defined in Crypto.JOSE.JWA.JWK showsPrec :: Int -> KeyMaterialGenParam -> ShowS # show :: KeyMaterialGenParam -> String # showList :: [KeyMaterialGenParam] -> ShowS # | |
Eq KeyMaterialGenParam Source # | |
Defined in Crypto.JOSE.JWA.JWK (==) :: KeyMaterialGenParam -> KeyMaterialGenParam -> Bool # (/=) :: KeyMaterialGenParam -> KeyMaterialGenParam -> Bool # |
data KeyMaterial Source #
Key material sum type.
ECKeyMaterial ECKeyParameters | |
RSAKeyMaterial RSAKeyParameters | |
OctKeyMaterial OctKeyParameters | |
OKPKeyMaterial OKPKeyParameters |
Instances
FromJSON KeyMaterial Source # | |
Defined in Crypto.JOSE.JWA.JWK parseJSON :: Value -> Parser KeyMaterial # parseJSONList :: Value -> Parser [KeyMaterial] # | |
ToJSON KeyMaterial Source # | |
Defined in Crypto.JOSE.JWA.JWK toJSON :: KeyMaterial -> Value # toEncoding :: KeyMaterial -> Encoding # toJSONList :: [KeyMaterial] -> Value # toEncodingList :: [KeyMaterial] -> Encoding # | |
Show KeyMaterial Source # | |
Defined in Crypto.JOSE.JWA.JWK showsPrec :: Int -> KeyMaterial -> ShowS # show :: KeyMaterial -> String # showList :: [KeyMaterial] -> ShowS # | |
Eq KeyMaterial Source # | |
Defined in Crypto.JOSE.JWA.JWK (==) :: KeyMaterial -> KeyMaterial -> Bool # (/=) :: KeyMaterial -> KeyMaterial -> Bool # | |
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