Documentation ¶
Index ¶
- Constants
- func AesKeyUnwrap(key, cipherText []byte) ([]byte, error)
- func AesKeyWrap(key, plainText []byte) ([]byte, error)
- func VerifyAndDecrypt(jwe string, kp KeyProvider) ([]byte, error)
- func VerifyAndDecryptDraft7(jwe string, kp KeyProvider) ([]byte, error)
- type Algorithm
- type EncryptionMethod
- type Header
- type KeyProvider
Constants ¶
View Source
const ( ALG_RSA_OAEP = Algorithm("RSA-OAEP") ALG_RSA_OAEP_256 = Algorithm("RSA-OAEP-256") ALG_RSA1_5 = Algorithm("RSA1_5") ALG_A128KW = Algorithm("A128KW") ALG_A256KW = Algorithm("A256KW") )
View Source
const ( ENC_A128CBC_HS256_v7 = EncryptionMethod("A128CBC+HS256") ENC_A256CBC_HS512_v7 = EncryptionMethod("A256CBC+H512") ENC_A128CBC_HS256 = EncryptionMethod("A128CBC-HS256") ENC_A256CBC_HS512 = EncryptionMethod("A256CBC-HS512") ENC_A128GCM = EncryptionMethod("A128GCM") ENC_A256GCM = EncryptionMethod("A256GCM") )
Variables ¶
This section is empty.
Functions ¶
func VerifyAndDecrypt ¶
func VerifyAndDecrypt(jwe string, kp KeyProvider) ([]byte, error)
Verify and decrypt a JWE object
func VerifyAndDecryptDraft7 ¶
func VerifyAndDecryptDraft7(jwe string, kp KeyProvider) ([]byte, error)
Types ¶
type EncryptionMethod ¶
type EncryptionMethod string
type Header ¶
type Header struct { Alg Algorithm `json:"alg"` Enc EncryptionMethod `json:"enc"` Zip string `json:"zip"` Jku string `json:"jku,omitempty"` Jwk string `json:"jwk,omitempty"` X5u string `json:"x5u,omitempty"` X5t string `json:"x5t,omitempty"` X5c string `json:"x5c,omitempty"` Kid string `json:"kid,omitempty"` }
The JWE header
type KeyProvider ¶
type KeyProvider interface {
GetKey(header Header) (crypto.PrivateKey, error)
}
interface to retrieve the private key needed to decrypt the JWE
func ProviderFromKey ¶
func ProviderFromKey(key crypto.PrivateKey) KeyProvider
convert a single key into a provider
Click to show internal directories.
Click to hide internal directories.