algorithm

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 24, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetHash added in v0.3.0

func GetHash(algorithm SignatureAlgorithm) (crypto.Hash, error)

Types

type Algorithm

type Algorithm interface {
	Encrypt(algorithm EncryptionAlgorithm, plaintext []byte) (EncryptResult, error)
	Verify(algorithm SignatureAlgorithm, digest, signature []byte) (VerifyResult, error)
	WrapKey(algorithm KeyWrapAlgorithm, key []byte) (WrapKeyResult, error)
}

func NewAlgorithm added in v0.3.0

func NewAlgorithm(key azkeys.JSONWebKey) (Algorithm, error)

type DecryptResult added in v0.3.0

type DecryptResult struct {
	// Algorithm is encryption algorithm used to decrypt.
	Algorithm EncryptionAlgorithm

	// 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) Encrypt added in v0.3.0

func (c ECDsa) Encrypt(algorithm EncryptionAlgorithm, plaintext []byte) (EncryptResult, error)

func (ECDsa) Verify

func (c ECDsa) Verify(algorithm SignatureAlgorithm, digest, signature []byte) (VerifyResult, error)

func (ECDsa) WrapKey added in v0.3.0

func (c ECDsa) WrapKey(algorithm KeyWrapAlgorithm, key []byte) (WrapKeyResult, error)

type EncryptResult added in v0.3.0

type EncryptResult struct {
	// Algorithm is encryption algorithm used to encrypt.
	Algorithm EncryptionAlgorithm

	// KeyID is the key ID used to encrypt. This key ID should be retained.
	KeyID string

	// Ciphertext is the encryption result.
	Ciphertext []byte
}

type EncryptionAlgorithm added in v0.3.0

type EncryptionAlgorithm = azkeys.JSONWebKeyEncryptionAlgorithm

type KeyWrapAlgorithm added in v0.3.0

type KeyWrapAlgorithm = azkeys.JSONWebKeyEncryptionAlgorithm

type RSA added in v0.3.0

type RSA struct {
	// contains filtered or unexported fields
}

func (RSA) Encrypt added in v0.3.0

func (r RSA) Encrypt(algorithm EncryptionAlgorithm, plaintext []byte) (EncryptResult, error)

func (RSA) Verify added in v0.3.0

func (r RSA) Verify(algorithm SignatureAlgorithm, digest, signature []byte) (VerifyResult, error)

func (RSA) WrapKey added in v0.3.0

func (r RSA) WrapKey(algorithm KeyWrapAlgorithm, key []byte) (WrapKeyResult, error)

type SignResult

type SignResult struct {
	// Algorithm is the signature algorithm used to sign.
	Algorithm SignatureAlgorithm

	// 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 SignatureAlgorithm

type SignatureAlgorithm = azkeys.JSONWebKeySignatureAlgorithm

type UnwrapKeyResult added in v0.3.0

type UnwrapKeyResult struct {
	// Algorithm is the key wrap algorithm used to unwrap.
	Algorithm KeyWrapAlgorithm

	// 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 SignatureAlgorithm

	// KeyID is the key ID used to verify.
	KeyID string

	// Valid is true of the signature is valid.
	Valid bool
}

type WrapKeyResult added in v0.3.0

type WrapKeyResult struct {
	// Algorithm is the key wrap algorithm used to wrap.
	Algorithm KeyWrapAlgorithm

	// KeyID is the key ID used to wrap. This key ID should be retained.
	KeyID string

	// EncryptedKey is the wrapped (encrypted) key.
	EncryptedKey []byte
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL