Documentation
¶
Index ¶
- Constants
- Variables
- func NewJWE(alg KeyAlgorithm, key interface{}, method EncryptionType, plaintext []byte) (*jwe, error)
- func ParseEncrypted(input string) (*jwe, error)
- func ParseRSAPrivateKeyFromPEM(key []byte) (*rsa.PrivateKey, error)
- func ParseRSAPublicKeyFromPEM(key []byte) (*rsa.PublicKey, error)
- type EncryptionType
- type KeyAlgorithm
Constants ¶
View Source
const TagSizeAESGCM = 16
Variables ¶
View Source
var ( ErrInvalidKeySize = errors.New("invalid key size") ErrInvalidTagSize = errors.New("invalid tag size") ErrInvalidNonceSize = errors.New("invalid nonce size") ErrUnsupportedEncryptionType = errors.New("unsupported encryption type") )
View Source
var ( ErrMissingEncHeader = errors.New("missing \"enc\" header") ErrMissingAlgHeader = errors.New("missing \"alg\" header") )
View Source
var ( ErrUnsupportedKeyType = errors.New("unsupported key type") ErrUnsupportedKeyAlgorithm = errors.New("unsupported key algorithm") )
View Source
var ( ErrKeyMustBePEMEncoded = errors.New("invalid key: Key must be a PEM encoded PKCS1 or PKCS8 key") ErrNotRSAPrivateKey = errors.New("key is not a valid RSA private key") ErrNotRSAPublicKey = errors.New("key is not a valid RSA public key") )
View Source
var EncryptionTypeA256GCM = EncryptionType("A256GCM")
View Source
var KeyAlgorithmRSAOAEP = KeyAlgorithm("RSA-OAEP")
View Source
var RandReader = rand.Reader
Functions ¶
func NewJWE ¶
func NewJWE(alg KeyAlgorithm, key interface{}, method EncryptionType, plaintext []byte) (*jwe, error)
NewJWE creates a new JWE token. The plaintext will be encrypted with the method using a Content Encryption Key (cek). The cek will be encrypted with the alg using the key.
func ParseEncrypted ¶
func ParseRSAPrivateKeyFromPEM ¶
func ParseRSAPrivateKeyFromPEM(key []byte) (*rsa.PrivateKey, error)
ParseRSAPrivateKeyFromPEM parses a PEM encoded PKCS1 or PKCS8 private key
Types ¶
type EncryptionType ¶
type EncryptionType string
type KeyAlgorithm ¶
type KeyAlgorithm string
Click to show internal directories.
Click to hide internal directories.