Documentation
¶
Index ¶
- func AESGenerateIV(rand io.Reader) ([]byte, error)
- func AESGenerateNonce(rand io.Reader) ([]byte, error)
- func As[T any](algorithm any, target *T) bool
- func GetHash(algorithm SignAlgorithm) (crypto.Hash, error)
- func NewAlgorithm(key azkeys.JSONWebKey, rand io.Reader) (any, error)
- type AES
- func (a AES) DecryptAESCBC(algorithm EncryptAESCBCAlgorithm, ciphertext, iv []byte) (DecryptResult, error)
- func (a AES) DecryptAESGCM(algorithm EncryptAESGCMAlgorithm, ...) (DecryptResult, error)
- func (a AES) EncryptAESCBC(algorithm EncryptAESCBCAlgorithm, plaintext, iv []byte) (EncryptResult, error)
- func (a AES) EncryptAESGCM(algorithm EncryptAESGCMAlgorithm, ...) (EncryptResult, error)
- func (a AES) UnwrapKey(algorithm WrapKeyAlgorithm, encryptedKey []byte) (UnwrapKeyResult, error)
- func (a AES) WrapKey(algorithm WrapKeyAlgorithm, key []byte) (WrapKeyResult, error)
- type AESEncrypter
- type DecryptResult
- type ECDsa
- type EncryptAESCBCAlgorithm
- type EncryptAESGCMAlgorithm
- type EncryptAlgorithm
- type EncryptResult
- type Encrypter
- type KeyWrapper
- type RSA
- func (r RSA) Decrypt(algorithm EncryptAlgorithm, ciphertext []byte) (DecryptResult, error)
- func (r RSA) Encrypt(algorithm EncryptAlgorithm, plaintext []byte) (EncryptResult, error)
- func (r RSA) Sign(algorithm SignAlgorithm, digest []byte) (SignResult, error)
- func (r RSA) UnwrapKey(algorithm WrapKeyAlgorithm, encryptedKey []byte) (UnwrapKeyResult, error)
- func (r RSA) Verify(algorithm SignAlgorithm, digest, signature []byte) (VerifyResult, error)
- func (r RSA) WrapKey(algorithm WrapKeyAlgorithm, key []byte) (WrapKeyResult, error)
- type SignAlgorithm
- type SignResult
- type Signer
- type UnwrapKeyResult
- type VerifyResult
- type WrapKeyAlgorithm
- type WrapKeyResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewAlgorithm ¶ added in v0.3.0
Types ¶
type AES ¶ added in v0.5.0
type AES struct {
// contains filtered or unexported fields
}
func (AES) DecryptAESCBC ¶ added in v0.7.0
func (a AES) DecryptAESCBC(algorithm EncryptAESCBCAlgorithm, ciphertext, iv []byte) (DecryptResult, error)
func (AES) DecryptAESGCM ¶ added in v0.7.0
func (a AES) DecryptAESGCM(algorithm EncryptAESGCMAlgorithm, ciphertext, nonce, authenticationTag, additionalAuthenticatedData []byte) (DecryptResult, error)
func (AES) EncryptAESCBC ¶ added in v0.5.0
func (a AES) EncryptAESCBC(algorithm EncryptAESCBCAlgorithm, plaintext, iv []byte) (EncryptResult, error)
func (AES) EncryptAESGCM ¶ added in v0.5.0
func (a AES) EncryptAESGCM(algorithm EncryptAESGCMAlgorithm, plaintext, nonce, additionalAuthenticatedData []byte) (EncryptResult, error)
func (AES) UnwrapKey ¶ added in v0.7.0
func (a AES) UnwrapKey(algorithm WrapKeyAlgorithm, encryptedKey []byte) (UnwrapKeyResult, error)
func (AES) WrapKey ¶ added in v0.6.0
func (a AES) WrapKey(algorithm WrapKeyAlgorithm, key []byte) (WrapKeyResult, error)
type AESEncrypter ¶ added in v0.5.0
type AESEncrypter interface {
EncryptAESCBC(algorithm EncryptAESCBCAlgorithm, plaintext, iv []byte) (EncryptResult, error)
DecryptAESCBC(algorithm EncryptAESCBCAlgorithm, ciphertext, iv []byte) (DecryptResult, error)
EncryptAESGCM(algorithm EncryptAESGCMAlgorithm, plaintext, nonce, additionalAuthenticatedData []byte) (EncryptResult, error)
DecryptAESGCM(algorithm EncryptAESGCMAlgorithm, ciphertext, nonce, authenticationTag, additionalAuthenticatedData []byte) (DecryptResult, error)
}
type DecryptResult ¶ added in v0.3.0
type DecryptResult struct {
// Algorithm is encryption algorithm used to decrypt.
Algorithm EncryptAlgorithm
// KeyID is the key ID used to decrypt.
KeyID string
// Plaintext is the decryption result.
Plaintext []byte
}
type ECDsa ¶
type ECDsa struct {
// contains filtered or unexported fields
}
func (ECDsa) Sign ¶
func (c ECDsa) Sign(algorithm SignAlgorithm, digest []byte) (SignResult, error)
func (ECDsa) Verify ¶
func (c ECDsa) Verify(algorithm SignAlgorithm, digest, signature []byte) (VerifyResult, error)
type EncryptAESCBCAlgorithm ¶ added in v0.5.0
type EncryptAESCBCAlgorithm = azkeys.EncryptionAlgorithm
type EncryptAESGCMAlgorithm ¶ added in v0.5.0
type EncryptAESGCMAlgorithm = azkeys.EncryptionAlgorithm
type EncryptAlgorithm ¶ added in v0.5.0
type EncryptAlgorithm = azkeys.EncryptionAlgorithm
type EncryptResult ¶ added in v0.3.0
type EncryptResult struct {
// Algorithm is encryption algorithm used to encrypt.
Algorithm EncryptAlgorithm
// KeyID is the key ID used to encrypt. This key ID should be retained.
KeyID string
// Ciphertext is the encryption result.
Ciphertext []byte
// IV is the initialization vector used to encrypt using AES-CBC.
IV []byte
// Nonce is the nonce used to encrypt using AES-GCM.
Nonce []byte
// AdditionalAuthenticatedData passed to EncryptAESGCM.
AdditionalAuthenticatedData []byte
// AuthenticationTag returned from EncryptAESGCM.
AuthenticationTag []byte
}
type Encrypter ¶ added in v0.5.0
type Encrypter interface {
Encrypt(algorithm EncryptAlgorithm, plaintext []byte) (EncryptResult, error)
Decrypt(algorithm EncryptAlgorithm, ciphertext []byte) (DecryptResult, error)
}
type KeyWrapper ¶ added in v0.6.0
type KeyWrapper interface {
WrapKey(algorithm WrapKeyAlgorithm, key []byte) (WrapKeyResult, error)
UnwrapKey(algorithm WrapKeyAlgorithm, encryptedKey []byte) (UnwrapKeyResult, error)
}
type RSA ¶ added in v0.3.0
type RSA struct {
// contains filtered or unexported fields
}
func (RSA) Decrypt ¶ added in v0.7.0
func (r RSA) Decrypt(algorithm EncryptAlgorithm, ciphertext []byte) (DecryptResult, error)
func (RSA) Encrypt ¶ added in v0.3.0
func (r RSA) Encrypt(algorithm EncryptAlgorithm, plaintext []byte) (EncryptResult, error)
func (RSA) Sign ¶ added in v0.7.0
func (r RSA) Sign(algorithm SignAlgorithm, digest []byte) (SignResult, error)
func (RSA) UnwrapKey ¶ added in v0.7.0
func (r RSA) UnwrapKey(algorithm WrapKeyAlgorithm, encryptedKey []byte) (UnwrapKeyResult, error)
func (RSA) Verify ¶ added in v0.3.0
func (r RSA) Verify(algorithm SignAlgorithm, digest, signature []byte) (VerifyResult, error)
func (RSA) WrapKey ¶ added in v0.3.0
func (r RSA) WrapKey(algorithm WrapKeyAlgorithm, key []byte) (WrapKeyResult, error)
type SignAlgorithm ¶ added in v0.5.0
type SignAlgorithm = azkeys.SignatureAlgorithm
type SignResult ¶
type SignResult struct {
// Algorithm is the signature algorithm used to sign.
Algorithm SignAlgorithm
// KeyID is the key ID used to sign. This key ID should be retained.
KeyID string
// Signature is a signed hash of the data.
Signature []byte
}
type Signer ¶ added in v0.5.0
type Signer interface {
Sign(algorithm SignAlgorithm, digest []byte) (SignResult, error)
Verify(algorithm SignAlgorithm, digest, signature []byte) (VerifyResult, error)
}
type UnwrapKeyResult ¶ added in v0.3.0
type UnwrapKeyResult struct {
// Algorithm is the key wrap algorithm used to unwrap.
Algorithm WrapKeyAlgorithm
// KeyID is the key ID used to unwrap.
KeyID string
// Key is the unwrapped (decrypted) key.
Key []byte
}
type VerifyResult ¶
type VerifyResult struct {
// Algorithm is the signature algorithm used to verify.
Algorithm SignAlgorithm
// KeyID is the key ID used to verify.
KeyID string
// Valid is true of the signature is valid.
Valid bool
}
type WrapKeyAlgorithm ¶ added in v0.5.0
type WrapKeyAlgorithm = azkeys.EncryptionAlgorithm
type WrapKeyResult ¶ added in v0.3.0
type WrapKeyResult struct {
// Algorithm is the key wrap algorithm used to wrap.
Algorithm WrapKeyAlgorithm
// KeyID is the key ID used to wrap. This key ID should be retained.
KeyID string
// EncryptedKey is the wrapped (encrypted) key.
EncryptedKey []byte
}
Click to show internal directories.
Click to hide internal directories.