| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Jose.Jwe
Description
JWE RSA encrypted token support.
Example usage:
>>>import Jose.Jwe>>>import Jose.Jwa>>>import Crypto.Random.AESCtr>>>g <- makeSystem>>>import Crypto.PubKey.RSA>>>let ((kPub, kPr), g') = generate g 512 65537>>>let (jwt, g'') = rsaEncode g' RSA_OAEP A128GCM kPub "secret claims">>>rsaDecode kPr jwtRight (JweHeader {jweAlg = RSA_OAEP, jweEnc = A128GCM, jweTyp = Nothing, jweCty = Nothing, jweZip = Nothing, jweKid = Nothing},"secret claims")
- rsaEncode :: CPRG g => g -> JweAlg -> Enc -> PublicKey -> ByteString -> (ByteString, g)
- rsaDecode :: PrivateKey -> ByteString -> Either JwtError Jwe
Documentation
Arguments
| :: CPRG g | |
| => g | Random number generator |
| -> JweAlg | RSA algorithm to use ( |
| -> Enc | Content encryption algorithm |
| -> PublicKey | RSA key to encrypt with |
| -> ByteString | The JWT claims (content) |
| -> (ByteString, g) | The encoded JWE and new generator |
Creates a JWE.
Arguments
| :: PrivateKey | Decryption key |
| -> ByteString | The encoded JWE |
| -> Either JwtError Jwe | The decoded JWT, unless an error occurs |
Decrypts a JWE.