jose-0.5.0.4: Javascript Object Signing and Encryption and JSON Web Token library

Safe HaskellNone
LanguageHaskell98

Crypto.JOSE.JWK

Contents

Description

A JSON Web Key (JWK) is a JavaScript Object Notation (JSON) data structure that represents a cryptographic key. This module also defines a JSON Web Key Set (JWK Set) JSON data structure for representing a set of JWKs.

Synopsis

Documentation

data KeyUse Source #

JWK §3.2. "use" (Public Key Use) Parameter

Constructors

Sig 
Enc 

fromRSA :: PrivateKey -> JWK Source #

Convert RSA private key into a JWK

data JWKAlg Source #

RFC 7517 §4.4. "alg" (Algorithm) Parameter

See also RFC 7518 §6.4. which states that for "oct" keys, an "alg" member SHOULD be present to identify the algorithm intended to be used with the key, unless the application uses another means or convention to determine the algorithm used.

Constructors

JWSAlg Alg 
JWEAlg Alg 

newtype JWKSet Source #

JWK §4. JSON Web Key Set (JWK Set) Format

Constructors

JWKSet [JWK] 

bestJWSAlg :: (MonadError e m, AsError e) => JWK -> m Alg Source #

Choose the cryptographically strongest JWS algorithm for a given key. The JWK "alg" algorithm parameter is ignored.

Type classes

"kty" (Key Type) Parameter Values

data EC Source #

Elliptic Curve key type (Recommeded+)

Constructors

EC 

Instances

Eq EC Source # 

Methods

(==) :: EC -> EC -> Bool #

(/=) :: EC -> EC -> Bool #

Ord EC Source # 

Methods

compare :: EC -> EC -> Ordering #

(<) :: EC -> EC -> Bool #

(<=) :: EC -> EC -> Bool #

(>) :: EC -> EC -> Bool #

(>=) :: EC -> EC -> Bool #

max :: EC -> EC -> EC #

min :: EC -> EC -> EC #

Show EC Source # 

Methods

showsPrec :: Int -> EC -> ShowS #

show :: EC -> String #

showList :: [EC] -> ShowS #

ToJSON EC Source # 
FromJSON EC Source # 

data RSA Source #

RSA key type (Required)

Constructors

RSA 

Instances

Eq RSA Source # 

Methods

(==) :: RSA -> RSA -> Bool #

(/=) :: RSA -> RSA -> Bool #

Ord RSA Source # 

Methods

compare :: RSA -> RSA -> Ordering #

(<) :: RSA -> RSA -> Bool #

(<=) :: RSA -> RSA -> Bool #

(>) :: RSA -> RSA -> Bool #

(>=) :: RSA -> RSA -> Bool #

max :: RSA -> RSA -> RSA #

min :: RSA -> RSA -> RSA #

Show RSA Source # 

Methods

showsPrec :: Int -> RSA -> ShowS #

show :: RSA -> String #

showList :: [RSA] -> ShowS #

ToJSON RSA Source # 
FromJSON RSA Source # 

data Oct Source #

Octet sequence (symmetric key) key type (Required)

Constructors

Oct 

Instances

Eq Oct Source # 

Methods

(==) :: Oct -> Oct -> Bool #

(/=) :: Oct -> Oct -> Bool #

Ord Oct Source # 

Methods

compare :: Oct -> Oct -> Ordering #

(<) :: Oct -> Oct -> Bool #

(<=) :: Oct -> Oct -> Bool #

(>) :: Oct -> Oct -> Bool #

(>=) :: Oct -> Oct -> Bool #

max :: Oct -> Oct -> Oct #

min :: Oct -> Oct -> Oct #

Show Oct Source # 

Methods

showsPrec :: Int -> Oct -> ShowS #

show :: Oct -> String #

showList :: [Oct] -> ShowS #

ToJSON Oct Source # 
FromJSON Oct Source # 

Parameters for Elliptic Curve Keys

data Crv Source #

"crv" (Curve) Parameter

Constructors

P_256 
P_384 
P_521 

Instances

Eq Crv Source # 

Methods

(==) :: Crv -> Crv -> Bool #

(/=) :: Crv -> Crv -> Bool #

Ord Crv Source # 

Methods

compare :: Crv -> Crv -> Ordering #

(<) :: Crv -> Crv -> Bool #

(<=) :: Crv -> Crv -> Bool #

(>) :: Crv -> Crv -> Bool #

(>=) :: Crv -> Crv -> Bool #

max :: Crv -> Crv -> Crv #

min :: Crv -> Crv -> Crv #

Show Crv Source # 

Methods

showsPrec :: Int -> Crv -> ShowS #

show :: Crv -> String #

showList :: [Crv] -> ShowS #

Arbitrary Crv Source # 

Methods

arbitrary :: Gen Crv #

shrink :: Crv -> [Crv] #

ToJSON Crv Source # 
FromJSON Crv Source # 

Parameters for RSA Keys

Parameters for Symmetric Keys

Key generation

data KeyMaterialGenParam Source #

Keygen parameters.

Constructors

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.

Signing and verification