Documentation ¶
Index ¶
- func Unwrap(block cipher.Block, ciphertxt []byte) ([]byte, error)
- func Wrap(kek cipher.Block, cek []byte) ([]byte, error)
- type AESCGM
- type Decrypter
- type DirectDecrypt
- type ECDHESDecrypt
- type ECDHESEncrypt
- type Encrypter
- type RSAOAEPDecrypt
- type RSAOAEPEncrypt
- type RSAPKCS15Decrypt
- type RSAPKCSEncrypt
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AESCGM ¶
type AESCGM struct {
// contains filtered or unexported fields
}
AESCGM encrypts content encryption keys using AES-CGM key wrap. Contrary to what the name implies, it also decrypt encrypted keys
func NewAESCGM ¶
func NewAESCGM(alg jwa.KeyEncryptionAlgorithm, sharedkey []byte) (*AESCGM, error)
NewAESCGM creates a key-wrap encrypter using AES-CGM. Although the name suggests otherwise, this does the decryption as well.
func (*AESCGM) Algorithm ¶
func (kw *AESCGM) Algorithm() jwa.KeyEncryptionAlgorithm
Algorithm returns the key encryption algorithm being used
type Decrypter ¶
type Decrypter interface { Algorithm() jwa.KeyEncryptionAlgorithm Decrypt([]byte) ([]byte, error) }
Decrypter is an interface for things that can decrypt keys
type DirectDecrypt ¶
type DirectDecrypt struct {
Key []byte
}
DirectDecrypt does no encryption (Note: Unimplemented)
func (DirectDecrypt) Decrypt ¶
func (d DirectDecrypt) Decrypt() ([]byte, error)
Decrypt for DirectDecrypt does not do anything other than return a copy of the embedded key
type ECDHESDecrypt ¶
type ECDHESDecrypt struct {
// contains filtered or unexported fields
}
ECDHESDecrypt decrypts keys using ECDH-ES.
func NewECDHESDecrypt ¶
func NewECDHESDecrypt(alg jwa.KeyEncryptionAlgorithm, pubkey *ecdsa.PublicKey, apu, apv []byte, privkey *ecdsa.PrivateKey) *ECDHESDecrypt
NewECDHESDecrypt creates a new key decrypter using ECDH-ES
func (ECDHESDecrypt) Algorithm ¶
func (kw ECDHESDecrypt) Algorithm() jwa.KeyEncryptionAlgorithm
Algorithm returns the key encryption algorithm being used
type ECDHESEncrypt ¶
type ECDHESEncrypt struct {
// contains filtered or unexported fields
}
ECDHESEncrypt encrypts content encryption keys using ECDH-ES.
func NewECDHESEncrypt ¶
func NewECDHESEncrypt(alg jwa.KeyEncryptionAlgorithm, key *ecdsa.PublicKey) (*ECDHESEncrypt, error)
NewECDHESEncrypt creates a new key encrypter based on ECDH-ES
func (ECDHESEncrypt) Algorithm ¶
func (kw ECDHESEncrypt) Algorithm() jwa.KeyEncryptionAlgorithm
Algorithm returns the key encryption algorithm being used
func (ECDHESEncrypt) Encrypt ¶
func (kw ECDHESEncrypt) Encrypt(cek []byte) (keygen.ByteSource, error)
KeyEncrypt encrypts the content encryption key using ECDH-ES
func (ECDHESEncrypt) KeyID ¶
func (kw ECDHESEncrypt) KeyID() string
KeyID returns the key ID associated with this encrypter
type Encrypter ¶
type Encrypter interface { Algorithm() jwa.KeyEncryptionAlgorithm Encrypt([]byte) (keygen.ByteSource, error) // KeyID returns the key id for this Encrypter. This exists so that // you can pass in a Encrypter to MultiEncrypt, you can rest assured // that the generated key will have the proper key ID. KeyID() string }
Encrypter is an interface for things that can encrypt keys
type RSAOAEPDecrypt ¶
type RSAOAEPDecrypt struct {
// contains filtered or unexported fields
}
RSAOAEPDecrypt decrypts keys using RSA OAEP algorithm
func NewRSAOAEPDecrypt ¶
func NewRSAOAEPDecrypt(alg jwa.KeyEncryptionAlgorithm, privkey *rsa.PrivateKey) (*RSAOAEPDecrypt, error)
NewRSAOAEPDecrypt creates a new key decrypter using RSA OAEP
func (RSAOAEPDecrypt) Algorithm ¶
func (d RSAOAEPDecrypt) Algorithm() jwa.KeyEncryptionAlgorithm
Algorithm returns the key encryption algorithm being used
type RSAOAEPEncrypt ¶
type RSAOAEPEncrypt struct {
// contains filtered or unexported fields
}
RSAOAEPEncrypt encrypts keys using RSA OAEP algorithm
func NewRSAOAEPEncrypt ¶
func NewRSAOAEPEncrypt(alg jwa.KeyEncryptionAlgorithm, pubkey *rsa.PublicKey) (*RSAOAEPEncrypt, error)
NewRSAOAEPEncrypt creates a new key encrypter using RSA OAEP
func (RSAOAEPEncrypt) Algorithm ¶
func (e RSAOAEPEncrypt) Algorithm() jwa.KeyEncryptionAlgorithm
Algorithm returns the key encryption algorithm being used
func (RSAOAEPEncrypt) Encrypt ¶
func (e RSAOAEPEncrypt) Encrypt(cek []byte) (keygen.ByteSource, error)
KeyEncrypt encrypts the content encryption key using RSA OAEP
func (RSAOAEPEncrypt) KeyID ¶
func (e RSAOAEPEncrypt) KeyID() string
KeyID returns the key ID associated with this encrypter
type RSAPKCS15Decrypt ¶
type RSAPKCS15Decrypt struct {
// contains filtered or unexported fields
}
RSAPKCS15Decrypt decrypts keys using RSA PKCS1v15 algorithm
func NewRSAPKCS15Decrypt ¶
func NewRSAPKCS15Decrypt(alg jwa.KeyEncryptionAlgorithm, privkey *rsa.PrivateKey, keysize int) *RSAPKCS15Decrypt
NewRSAPKCS15Decrypt creates a new decrypter using RSA PKCS1v15
func (RSAPKCS15Decrypt) Algorithm ¶
func (d RSAPKCS15Decrypt) Algorithm() jwa.KeyEncryptionAlgorithm
Algorithm returns the key encryption algorithm being used
type RSAPKCSEncrypt ¶
type RSAPKCSEncrypt struct {
// contains filtered or unexported fields
}
RSAPKCSEncrypt encrypts keys using RSA PKCS1v15 algorithm
func NewRSAPKCSEncrypt ¶
func NewRSAPKCSEncrypt(alg jwa.KeyEncryptionAlgorithm, pubkey *rsa.PublicKey) (*RSAPKCSEncrypt, error)
NewRSAPKCSEncrypt creates a new key encrypter using PKCS1v15
func (RSAPKCSEncrypt) Algorithm ¶
func (e RSAPKCSEncrypt) Algorithm() jwa.KeyEncryptionAlgorithm
Algorithm returns the key encryption algorithm being used
func (RSAPKCSEncrypt) Encrypt ¶
func (e RSAPKCSEncrypt) Encrypt(cek []byte) (keygen.ByteSource, error)
KeyEncrypt encrypts the content encryption key using RSA PKCS1v15
func (RSAPKCSEncrypt) KeyID ¶
func (e RSAPKCSEncrypt) KeyID() string
KeyID returns the key ID associated with this encrypter