keyvault

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsAlgorithmSupported

func IsAlgorithmSupported(alg string) bool

IsAlgorithmSupported returns true if the algorithm is supported for encryption or signature

func VaultUrl added in v1.3.0

func VaultUrl(vault string) string

vaultUrl returns the URL for the Azure Key Vault Parameter vault can be one of: - The address of the vault, such as "https://<name>.vault.azure.net" (could be a different format if using different clouds or private endpoints) - The FQDN of the vault, such as "<name>.vault.azure.net" (or another domain if using different clouds or private endpoints) - Only the name of the vault, which will be formatted for "vault.azure.net"

Types

type Client

type Client interface {
	// Encrypt a message using a key stored in the Key Vault
	Encrypt(ctx context.Context, vault, keyName, keyVersion string, params azkeys.KeyOperationParameters) (*KeyVaultEncryptResponse, error)
	// Decrypt a message using a key stored in the Key Vault.
	Decrypt(ctx context.Context, vault, keyName, keyVersion string, params azkeys.KeyOperationParameters) (*KeyVaultDecryptResponse, error)
	// WrapKey wraps a key using the key-encryption-key stored in the Key Vault
	WrapKey(ctx context.Context, vault, keyName, keyVersion string, params azkeys.KeyOperationParameters) (*KeyVaultEncryptResponse, error)
	// UnwrapKey unwrap a wrapped key using the key-encryption-key stored in the Key Vault
	UnwrapKey(ctx context.Context, vault, keyName, keyVersion string, params azkeys.KeyOperationParameters) (*KeyVaultDecryptResponse, error)
	// Sign a message using a key stored in the Key Vault
	Sign(ctx context.Context, vault, keyName, keyVersion string, params azkeys.SignParameters) (*KeyVaultSignResponse, error)
	// Verify a signature using a key stored in the Key Vault
	Verify(ctx context.Context, vault, keyName, keyVersion string, params azkeys.VerifyParameters) (*KeyVaultVerifyResponse, error)
}

Client is a client for Azure Key Vault

func NewClient

func NewClient(opts ClientOptions) Client

NewClient returns a new Client object

type ClientFactory

type ClientFactory func(opts ClientOptions) Client

ClientFactory is the type for the NewClient function

type ClientOptions added in v1.3.0

type ClientOptions struct {
	AccessToken string
	Expiration  time.Time
	Tracer      *sdkTrace.TracerProvider
}

type KeyVaultDecryptResponse

type KeyVaultDecryptResponse struct {
	Data []byte `json:"data,omitempty"`
	// contains filtered or unexported fields
}

KeyVaultDecryptResponse is the response from the Decrypt and UnwrapKey methods

func (KeyVaultDecryptResponse) KeyID

func (b KeyVaultDecryptResponse) KeyID() string

KeyID returns the key ID

func (KeyVaultDecryptResponse) Raw

func (d KeyVaultDecryptResponse) Raw() []byte

Raw returns the raw response

func (*KeyVaultDecryptResponse) SetKeyID

func (b *KeyVaultDecryptResponse) SetKeyID(kid string)

SetKeyID sets the key ID

type KeyVaultEncryptResponse

type KeyVaultEncryptResponse struct {
	Data  []byte `json:"data,omitempty"`
	Nonce []byte `json:"nonce,omitempty"`
	Tag   []byte `json:"tag,omitempty"`
	// contains filtered or unexported fields
}

KeyVaultEncryptResponse is the response from the Encrypt and WrapKey methods

func (KeyVaultEncryptResponse) KeyID

func (b KeyVaultEncryptResponse) KeyID() string

KeyID returns the key ID

func (KeyVaultEncryptResponse) Raw

func (e KeyVaultEncryptResponse) Raw() []byte

Raw returns the raw response

func (*KeyVaultEncryptResponse) SetKeyID

func (b *KeyVaultEncryptResponse) SetKeyID(kid string)

SetKeyID sets the key ID

type KeyVaultResponse

type KeyVaultResponse interface {
	// Raw returns the raw response
	Raw() []byte
	// KeyID returns the key ID
	KeyID() string
}

KeyVaultResponse is the interface implemented by all response objects returned by the methods in this package

type KeyVaultSignResponse

type KeyVaultSignResponse struct {
	Data []byte `json:"data,omitempty"`
	// contains filtered or unexported fields
}

KeyVaultSignResponse is the response from the Sign method

func (KeyVaultSignResponse) KeyID

func (b KeyVaultSignResponse) KeyID() string

KeyID returns the key ID

func (KeyVaultSignResponse) Raw

func (s KeyVaultSignResponse) Raw() []byte

Raw returns the raw response

func (*KeyVaultSignResponse) SetKeyID

func (b *KeyVaultSignResponse) SetKeyID(kid string)

SetKeyID sets the key ID

type KeyVaultVerifyResponse

type KeyVaultVerifyResponse struct {
	Valid bool `json:"valid,omitempty"`
	// contains filtered or unexported fields
}

KeyVaultVerifyResponse is the response from the Verify method

func (KeyVaultVerifyResponse) KeyID

func (b KeyVaultVerifyResponse) KeyID() string

KeyID returns the key ID

func (KeyVaultVerifyResponse) Raw

func (v KeyVaultVerifyResponse) Raw() []byte

Raw returns the raw response

func (*KeyVaultVerifyResponse) SetKeyID

func (b *KeyVaultVerifyResponse) SetKeyID(kid string)

SetKeyID sets the key ID

Jump to

Keyboard shortcuts

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