Documentation ¶
Index ¶
- Variables
- func EnvelopeDecrypt(data *EnvelopeInfo, opt ...Option) ([]byte, error)
- type AeadType
- type BlobInfo
- func (*BlobInfo) Descriptor() ([]byte, []int)deprecated
- func (x *BlobInfo) GetCiphertext() []byte
- func (x *BlobInfo) GetClientData() *structpb.Struct
- func (x *BlobInfo) GetHmac() []byte
- func (x *BlobInfo) GetIv() []byte
- func (x *BlobInfo) GetKeyInfo() *KeyInfo
- func (x *BlobInfo) GetPlaintext() []byte
- func (x *BlobInfo) GetValuePath() stringdeprecated
- func (x *BlobInfo) GetWrapped() booldeprecated
- func (*BlobInfo) ProtoMessage()
- func (x *BlobInfo) ProtoReflect() protoreflect.Message
- func (x *BlobInfo) Reset()
- func (x *BlobInfo) String() string
- type EnvelopeInfo
- func (*EnvelopeInfo) Descriptor() ([]byte, []int)deprecated
- func (x *EnvelopeInfo) GetCiphertext() []byte
- func (x *EnvelopeInfo) GetIv() []byte
- func (x *EnvelopeInfo) GetKey() []byte
- func (*EnvelopeInfo) ProtoMessage()
- func (x *EnvelopeInfo) ProtoReflect() protoreflect.Message
- func (x *EnvelopeInfo) Reset()
- func (x *EnvelopeInfo) String() string
- type HashType
- type HmacComputer
- type HmacType
- type InitFinalizer
- type KeyEncoding
- func (KeyEncoding) Descriptor() protoreflect.EnumDescriptor
- func (x KeyEncoding) Enum() *KeyEncoding
- func (KeyEncoding) EnumDescriptor() ([]byte, []int)deprecated
- func (x KeyEncoding) Number() protoreflect.EnumNumber
- func (x KeyEncoding) String() string
- func (KeyEncoding) Type() protoreflect.EnumType
- type KeyExporter
- type KeyInfo
- func (*KeyInfo) Descriptor() ([]byte, []int)deprecated
- func (x *KeyInfo) GetFlags() uint64
- func (x *KeyInfo) GetHmacKeyId() string
- func (x *KeyInfo) GetHmacMechanism() uint64
- func (x *KeyInfo) GetKey() []byte
- func (x *KeyInfo) GetKeyEncoding() KeyEncoding
- func (x *KeyInfo) GetKeyId() string
- func (x *KeyInfo) GetKeyPurposes() []KeyPurpose
- func (x *KeyInfo) GetKeyType() KeyType
- func (x *KeyInfo) GetMechanism() uint64
- func (x *KeyInfo) GetWrappedKey() []byte
- func (x *KeyInfo) GetWrappedKeyEncoding() KeyEncoding
- func (*KeyInfo) ProtoMessage()
- func (x *KeyInfo) ProtoReflect() protoreflect.Message
- func (x *KeyInfo) Reset()
- func (x *KeyInfo) String() string
- type KeyPurpose
- type KeyType
- type Option
- func WithAad(with []byte) Option
- func WithConfigMap(with map[string]string) Option
- func WithDisallowEnvVars(disallowEnvVars bool) Option
- func WithIV(with []byte) Option
- func WithKeyEncoding(encoding KeyEncoding) Option
- func WithKeyId(with string) Option
- func WithKeyPurposes(purpose ...KeyPurpose) Option
- func WithKeyType(keyType KeyType) Option
- func WithRandomBytes(b []byte) Option
- func WithWrappedKeyEncoding(encoding KeyEncoding) Option
- func WithoutHMAC() Option
- type OptionFunc
- type Options
- func (*Options) Descriptor() ([]byte, []int)deprecated
- func (x *Options) GetWithAad() []byte
- func (x *Options) GetWithConfigMap() map[string]string
- func (x *Options) GetWithDisallowEnvVars() bool
- func (x *Options) GetWithIv() []byte
- func (x *Options) GetWithKeyEncoding() KeyEncoding
- func (x *Options) GetWithKeyId() string
- func (x *Options) GetWithKeyPurposes() []KeyPurpose
- func (x *Options) GetWithKeyType() KeyType
- func (x *Options) GetWithRandomBytes() []byte
- func (x *Options) GetWithWrappedKeyEncoding() KeyEncoding
- func (x *Options) GetWithoutHmac() bool
- func (*Options) ProtoMessage()
- func (x *Options) ProtoReflect() protoreflect.Message
- func (x *Options) Reset()
- func (x *Options) String() string
- type SigInfo
- func (*SigInfo) Descriptor() ([]byte, []int)deprecated
- func (x *SigInfo) GetHmacType() HmacType
- func (x *SigInfo) GetKeyInfo() *KeyInfo
- func (x *SigInfo) GetSignature() []byte
- func (*SigInfo) ProtoMessage()
- func (x *SigInfo) ProtoReflect() protoreflect.Message
- func (x *SigInfo) Reset()
- func (x *SigInfo) String() string
- type SigInfoSigner
- type SigInfoVerifier
- type TestInitFinalizer
- type TestInitFinalizerHmacComputer
- type TestWrapper
- func (t *TestWrapper) Decrypt(_ context.Context, dwi *BlobInfo, opts ...Option) ([]byte, error)
- func (t *TestWrapper) Encrypt(ctx context.Context, plaintext []byte, opts ...Option) (*BlobInfo, error)
- func (t *TestWrapper) HmacKeyId(_ context.Context) string
- func (t *TestWrapper) KeyBytes(context.Context) ([]byte, error)
- func (t *TestWrapper) KeyId(_ context.Context) (string, error)
- func (t *TestWrapper) SetConfig(_ context.Context, opt ...Option) (*WrapperConfig, error)
- func (t *TestWrapper) SetKeyId(k string)
- func (t *TestWrapper) Type(_ context.Context) (WrapperType, error)
- type Wrapper
- type WrapperConfig
- type WrapperType
Constants ¶
This section is empty.
Variables ¶
var ( HmacType_name = map[int32]string{ 0: "Unknown_HmacType", 1: "Sha224", 2: "Sha256", 3: "Sha384", 4: "Sha512", } HmacType_value = map[string]int32{ "Unknown_HmacType": 0, "Sha224": 1, "Sha256": 2, "Sha384": 3, "Sha512": 4, } )
Enum value maps for HmacType.
var ( KeyType_name = map[int32]string{ 0: "Unknown_KeyType", 1: "Rsa2048", 2: "Rsa3072", 3: "Rsa4096", 4: "Aes256", 5: "EdsaP256", 6: "EdsaP384", 7: "EdsaP521", 8: "HMAC", 9: "Ed25519", } KeyType_value = map[string]int32{ "Unknown_KeyType": 0, "Rsa2048": 1, "Rsa3072": 2, "Rsa4096": 3, "Aes256": 4, "EdsaP256": 5, "EdsaP384": 6, "EdsaP521": 7, "HMAC": 8, "Ed25519": 9, } )
Enum value maps for KeyType.
var ( KeyEncoding_name = map[int32]string{ 0: "Unknown_KeyEncoding", 1: "Pkix", 2: "Pkcs8", 3: "Bytes", } KeyEncoding_value = map[string]int32{ "Unknown_KeyEncoding": 0, "Pkix": 1, "Pkcs8": 2, "Bytes": 3, } )
Enum value maps for KeyEncoding.
var ( KeyPurpose_name = map[int32]string{ 0: "KeyPurpose_Unknown", 1: "Encrypt", 2: "Decrypt", 3: "Sign", 4: "Verify", 5: "Wrap", 6: "Unwrap", 7: "MAC", } KeyPurpose_value = map[string]int32{ "KeyPurpose_Unknown": 0, "Encrypt": 1, "Decrypt": 2, "Sign": 3, "Verify": 4, "Wrap": 5, "Unwrap": 6, "MAC": 7, } )
Enum value maps for KeyPurpose.
var ErrFunctionNotImplemented = errors.New("the wrapping plugin does not implement this function")
ErrFunctionNotImplemented represents a function that hasn't been implemented
var ErrInvalidParameter = errors.New("invalid parameter")
ErrInvalidParameter represents an invalid parameter error
var File_github_com_hashicorp_go_kms_wrapping_v2_types_proto protoreflect.FileDescriptor
Functions ¶
func EnvelopeDecrypt ¶
func EnvelopeDecrypt(data *EnvelopeInfo, opt ...Option) ([]byte, error)
EnvelopeDecrypt takes in EnvelopeInfo and potentially additional options and decrypts. Also note: if you provided a plaintext of []byte("") to EnvelopeEncrypt, then this function will return []byte(nil).
Supported options:
* wrapping.WithAad: Additional authenticated data that should be sourced from a separate location, and must match what was provided during envelope encryption.
Types ¶
type AeadType ¶
type AeadType uint32
These values define supported types of AEADs
func AeadTypeMap ¶
type BlobInfo ¶
type BlobInfo struct { // Ciphertext is the encrypted bytes // @gotags: class:"public" Ciphertext []byte `protobuf:"bytes,1,opt,name=ciphertext,proto3" json:"ciphertext,omitempty" class:"public"` // IV is the initialization value used during encryption // @gotags: class:"secret" Iv []byte `protobuf:"bytes,2,opt,name=iv,proto3" json:"iv,omitempty" class:"secret"` // HMAC is the bytes of the HMAC, if any // @gotags: class:"public" Hmac []byte `protobuf:"bytes,3,opt,name=hmac,proto3" json:"hmac,omitempty" class:"public"` // Wrapped can be used by the client to indicate whether Ciphertext actually // contains wrapped data or not. This can be useful if you want to reuse the // same struct to pass data along before and after wrapping. Deprecated in // favor of plaintext. // // Deprecated: Marked as deprecated in github.com.hashicorp.go.kms.wrapping.v2.types.proto. Wrapped bool `protobuf:"varint,4,opt,name=wrapped,proto3" json:"wrapped,omitempty"` // Plaintext can be used to allow the same struct to be used to pass data // along before and after (un)wrapping. // @gotags: class:"secret" Plaintext []byte `protobuf:"bytes,7,opt,name=plaintext,proto3" json:"plaintext,omitempty" class:"secret"` // KeyInfo contains information about the key that was used to create this value KeyInfo *KeyInfo `protobuf:"bytes,5,opt,name=key_info,json=keyInfo,proto3" json:"key_info,omitempty"` // ValuePath can be used by the client to store information about where the // value came from. Deprecated in favor of client_data. // @gotags: class:"public" // // Deprecated: Marked as deprecated in github.com.hashicorp.go.kms.wrapping.v2.types.proto. ValuePath string `protobuf:"bytes,6,opt,name=value_path,json=valuePath,proto3" json:"value_path,omitempty" class:"public"` // ClientData can be used by the client to store extra information, for // instance, the location/provenance of where an encrypted value came from // (useful for associating AAD to the encrypted value). ClientData *structpb.Struct `protobuf:"bytes,8,opt,name=client_data,json=clientData,proto3" json:"client_data,omitempty"` // contains filtered or unexported fields }
BlobInfo contains information about the encrypted value along with information about the key used to encrypt it
func (*BlobInfo) Descriptor
deprecated
func (*BlobInfo) GetCiphertext ¶
func (*BlobInfo) GetClientData ¶
func (*BlobInfo) GetKeyInfo ¶
func (*BlobInfo) GetPlaintext ¶
func (*BlobInfo) GetValuePath
deprecated
func (*BlobInfo) GetWrapped
deprecated
func (*BlobInfo) ProtoMessage ¶
func (*BlobInfo) ProtoMessage()
func (*BlobInfo) ProtoReflect ¶
func (x *BlobInfo) ProtoReflect() protoreflect.Message
type EnvelopeInfo ¶
type EnvelopeInfo struct { // Ciphertext is the ciphertext from the envelope // @gotags: class:"public" Ciphertext []byte `protobuf:"bytes,1,opt,name=ciphertext,proto3" json:"ciphertext,omitempty" class:"public"` // Key is the key used in the envelope // @gotags: class:"secret" Key []byte `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty" class:"secret"` // IV is the initialization value used during encryption in the envelope // @gotags: class:"secret" Iv []byte `protobuf:"bytes,3,opt,name=iv,proto3" json:"iv,omitempty" class:"secret"` // contains filtered or unexported fields }
EnvelopeInfo contains the information necessary to perfom encryption or decryption in an envelope fashion
func EnvelopeEncrypt ¶
func EnvelopeEncrypt(plaintext []byte, opt ...Option) (*EnvelopeInfo, error)
EnvelopeEncrypt takes in plaintext and envelope encrypts it, generating an EnvelopeInfo value. An empty plaintext is a valid parameter and will not cause an error. Also note: if you provide a plaintext of []byte(""), EnvelopeDecrypt will return []byte(nil).
Supported options:
* wrapping.WithAad: Additional authenticated data that should be sourced from a separate location, and must also be provided during envelope decryption
func (*EnvelopeInfo) Descriptor
deprecated
func (*EnvelopeInfo) Descriptor() ([]byte, []int)
Deprecated: Use EnvelopeInfo.ProtoReflect.Descriptor instead.
func (*EnvelopeInfo) GetCiphertext ¶
func (x *EnvelopeInfo) GetCiphertext() []byte
func (*EnvelopeInfo) GetIv ¶
func (x *EnvelopeInfo) GetIv() []byte
func (*EnvelopeInfo) GetKey ¶
func (x *EnvelopeInfo) GetKey() []byte
func (*EnvelopeInfo) ProtoMessage ¶
func (*EnvelopeInfo) ProtoMessage()
func (*EnvelopeInfo) ProtoReflect ¶
func (x *EnvelopeInfo) ProtoReflect() protoreflect.Message
func (*EnvelopeInfo) Reset ¶
func (x *EnvelopeInfo) Reset()
func (*EnvelopeInfo) String ¶
func (x *EnvelopeInfo) String() string
type HashType ¶
type HashType uint32
These values define supported types of hashes
func HashTypeMap ¶
type HmacComputer ¶
type HmacType ¶ added in v2.0.9
type HmacType int32
HmacType defines the hmac algorithm type
func (HmacType) Descriptor ¶ added in v2.0.9
func (HmacType) Descriptor() protoreflect.EnumDescriptor
func (HmacType) EnumDescriptor
deprecated
added in
v2.0.9
func (HmacType) Number ¶ added in v2.0.9
func (x HmacType) Number() protoreflect.EnumNumber
func (HmacType) Type ¶ added in v2.0.9
func (HmacType) Type() protoreflect.EnumType
type InitFinalizer ¶
type InitFinalizer interface { // Init allows performing any necessary setup calls before using a // Wrapper. Init(ctx context.Context, options ...Option) error // Finalize can be called when all usage of a Wrapper is done if any cleanup // or finalization is required. Finalize(ctx context.Context, options ...Option) error }
type KeyEncoding ¶ added in v2.0.9
type KeyEncoding int32
const ( KeyEncoding_Unknown_KeyEncoding KeyEncoding = 0 KeyEncoding_Pkix KeyEncoding = 1 KeyEncoding_Pkcs8 KeyEncoding = 2 KeyEncoding_Bytes KeyEncoding = 3 )
func (KeyEncoding) Descriptor ¶ added in v2.0.9
func (KeyEncoding) Descriptor() protoreflect.EnumDescriptor
func (KeyEncoding) Enum ¶ added in v2.0.9
func (x KeyEncoding) Enum() *KeyEncoding
func (KeyEncoding) EnumDescriptor
deprecated
added in
v2.0.9
func (KeyEncoding) EnumDescriptor() ([]byte, []int)
Deprecated: Use KeyEncoding.Descriptor instead.
func (KeyEncoding) Number ¶ added in v2.0.9
func (x KeyEncoding) Number() protoreflect.EnumNumber
func (KeyEncoding) String ¶ added in v2.0.9
func (x KeyEncoding) String() string
func (KeyEncoding) Type ¶ added in v2.0.9
func (KeyEncoding) Type() protoreflect.EnumType
type KeyExporter ¶ added in v2.0.4
type KeyExporter interface { // KeyBytes returns the "current" key bytes KeyBytes(context.Context) ([]byte, error) }
KeyExporter defines an optional interface for wrappers to implement that returns the "current" key bytes. This will be implementation-specific.
type KeyInfo ¶
type KeyInfo struct { // Mechanism is the method used by the wrapper to encrypt and sign the // data as defined by the wrapper. (optional) Mechanism uint64 `protobuf:"varint,1,opt,name=mechanism,proto3" json:"mechanism,omitempty"` HmacMechanism uint64 `protobuf:"varint,2,opt,name=hmac_mechanism,json=hmacMechanism,proto3" json:"hmac_mechanism,omitempty"` // This is an opaque ID used by the wrapper to identify the specific key to // use as defined by the wrapper. This could be a version, key label, or // something else. (optional) // @gotags: class:"public" KeyId string `protobuf:"bytes,3,opt,name=key_id,json=keyId,proto3" json:"key_id,omitempty" class:"public"` // @gotags: class:"public" HmacKeyId string `protobuf:"bytes,4,opt,name=hmac_key_id,json=hmacKeyId,proto3" json:"hmac_key_id,omitempty" class:"public"` // These value are used when generating our own data encryption keys // and encrypting them using the wrapper (optional) // @gotags: class:"secret" WrappedKey []byte `protobuf:"bytes,5,opt,name=wrapped_key,json=wrappedKey,proto3" json:"wrapped_key,omitempty" class:"secret"` // Mechanism specific flags (optional) Flags uint64 `protobuf:"varint,6,opt,name=flags,proto3" json:"flags,omitempty"` // The key type (optional) KeyType KeyType `` /* 142-byte string literal not displayed */ // The key purposes (optional) KeyPurposes []KeyPurpose `` /* 164-byte string literal not displayed */ // plaintext key used when generating our own data encryption // keys (optional) // @gotags: class:"secret" Key []byte `protobuf:"bytes,9,opt,name=key,proto3" json:"key,omitempty" class:"secret"` // encoding of the key (optional) KeyEncoding KeyEncoding `` /* 159-byte string literal not displayed */ // encoding of the wrapped_key (optional) WrappedKeyEncoding KeyEncoding `` /* 182-byte string literal not displayed */ // contains filtered or unexported fields }
KeyInfo contains information regarding which Wrapper key was used to encrypt the entry
func (*KeyInfo) Descriptor
deprecated
func (*KeyInfo) GetHmacKeyId ¶
func (*KeyInfo) GetHmacMechanism ¶
func (*KeyInfo) GetKeyEncoding ¶ added in v2.0.9
func (x *KeyInfo) GetKeyEncoding() KeyEncoding
func (*KeyInfo) GetKeyPurposes ¶ added in v2.0.9
func (x *KeyInfo) GetKeyPurposes() []KeyPurpose
func (*KeyInfo) GetKeyType ¶ added in v2.0.9
func (*KeyInfo) GetMechanism ¶
func (*KeyInfo) GetWrappedKey ¶
func (*KeyInfo) GetWrappedKeyEncoding ¶ added in v2.0.9
func (x *KeyInfo) GetWrappedKeyEncoding() KeyEncoding
func (*KeyInfo) ProtoMessage ¶
func (*KeyInfo) ProtoMessage()
func (*KeyInfo) ProtoReflect ¶
func (x *KeyInfo) ProtoReflect() protoreflect.Message
type KeyPurpose ¶ added in v2.0.9
type KeyPurpose int32
KeyPurpose defines the cryptographic capabilities of a key.
const ( KeyPurpose_KeyPurpose_Unknown KeyPurpose = 0 KeyPurpose_Encrypt KeyPurpose = 1 KeyPurpose_Decrypt KeyPurpose = 2 KeyPurpose_Sign KeyPurpose = 3 KeyPurpose_Verify KeyPurpose = 4 KeyPurpose_Wrap KeyPurpose = 5 KeyPurpose_Unwrap KeyPurpose = 6 KeyPurpose_MAC KeyPurpose = 7 )
func (KeyPurpose) Descriptor ¶ added in v2.0.9
func (KeyPurpose) Descriptor() protoreflect.EnumDescriptor
func (KeyPurpose) Enum ¶ added in v2.0.9
func (x KeyPurpose) Enum() *KeyPurpose
func (KeyPurpose) EnumDescriptor
deprecated
added in
v2.0.9
func (KeyPurpose) EnumDescriptor() ([]byte, []int)
Deprecated: Use KeyPurpose.Descriptor instead.
func (KeyPurpose) Number ¶ added in v2.0.9
func (x KeyPurpose) Number() protoreflect.EnumNumber
func (KeyPurpose) String ¶ added in v2.0.9
func (x KeyPurpose) String() string
func (KeyPurpose) Type ¶ added in v2.0.9
func (KeyPurpose) Type() protoreflect.EnumType
type KeyType ¶ added in v2.0.9
type KeyType int32
KeyType defines the key's type
func (KeyType) Descriptor ¶ added in v2.0.9
func (KeyType) Descriptor() protoreflect.EnumDescriptor
func (KeyType) EnumDescriptor
deprecated
added in
v2.0.9
func (KeyType) Number ¶ added in v2.0.9
func (x KeyType) Number() protoreflect.EnumNumber
func (KeyType) Type ¶ added in v2.0.9
func (KeyType) Type() protoreflect.EnumType
type Option ¶
type Option func() interface{}
Option - a type that wraps an interface for compile-time safety but can contain an option for this package or for wrappers implementing this interface.
func WithConfigMap ¶
WithConfigMap is an option accepted by wrappers at configuration time and/or in other function calls to control wrapper-specific behavior.
func WithDisallowEnvVars ¶ added in v2.0.9
WithDisallowEnvVars provides a common way to configure ignoring environment variables
func WithKeyEncoding ¶ added in v2.0.9
func WithKeyEncoding(encoding KeyEncoding) Option
WithKeyEncoding provides a common way to pass in a key encoding
func WithKeyPurposes ¶ added in v2.0.9
func WithKeyPurposes(purpose ...KeyPurpose) Option
WithKeyPurpose provides a common way to pass in a key purpose
func WithKeyType ¶ added in v2.0.9
WithKeyType provides a common way to pass in a key type
func WithRandomBytes ¶ added in v2.0.9
WithRandomBytes provides a common way to pass in entropy
func WithWrappedKeyEncoding ¶ added in v2.0.9
func WithWrappedKeyEncoding(encoding KeyEncoding) Option
WithWrappedKeyEncoding provides a common way to pass in a wrapped_key encoding
func WithoutHMAC ¶ added in v2.0.10
func WithoutHMAC() Option
WithoutHMAC disables the requirement for an HMAC to be included with the mechanism.
type OptionFunc ¶
OptionFunc - a type for funcs that operate on the shared Options struct. The options below explicitly wrap this so that we can switch on it when parsing opts for various wrappers.
type Options ¶
type Options struct { // The key ID being specified // @gotags: class:"public" WithKeyId string `protobuf:"bytes,10,opt,name=with_key_id,json=withKeyId,proto3" json:"with_key_id,omitempty" class:"public"` // The AAD bytes, if any // @gotags: class:"secret" WithAad []byte `protobuf:"bytes,20,opt,name=with_aad,json=withAad,proto3" json:"with_aad,omitempty" class:"secret"` // @gotags: class:"secret" WithIv []byte `protobuf:"bytes,12,opt,name=with_iv,json=withIv,proto3" json:"with_iv,omitempty" class:"secret"` // Wrapper-specific configuration to pass along WithConfigMap map[string]string `` /* 191-byte string literal not displayed */ // The purposes of the key being specified WithKeyPurposes []KeyPurpose `` /* 179-byte string literal not displayed */ // The type of the key being specified WithKeyType KeyType `` /* 157-byte string literal not displayed */ // optional bytes of entropy // @gotags: class:"secret" WithRandomBytes []byte `protobuf:"bytes,60,opt,name=with_random_bytes,json=withRandomBytes,proto3" json:"with_random_bytes,omitempty" class:"secret"` // encoding of the key WithKeyEncoding KeyEncoding `` /* 173-byte string literal not displayed */ // encoding of the wrapped_key WithWrappedKeyEncoding KeyEncoding `` /* 196-byte string literal not displayed */ WithDisallowEnvVars bool `protobuf:"varint,90,opt,name=with_disallow_env_vars,json=withDisallowEnvVars,proto3" json:"with_disallow_env_vars,omitempty"` // WithoutHmac specifies that an HMAC is not necessary for the mechanism, even if marked as "required" WithoutHmac bool `protobuf:"varint,100,opt,name=without_hmac,json=withoutHmac,proto3" json:"without_hmac,omitempty"` // contains filtered or unexported fields }
Options holds options common to all wrappers
func (*Options) Descriptor
deprecated
func (*Options) GetWithAad ¶
func (*Options) GetWithConfigMap ¶
func (*Options) GetWithDisallowEnvVars ¶ added in v2.0.9
func (*Options) GetWithKeyEncoding ¶ added in v2.0.9
func (x *Options) GetWithKeyEncoding() KeyEncoding
func (*Options) GetWithKeyId ¶
func (*Options) GetWithKeyPurposes ¶ added in v2.0.9
func (x *Options) GetWithKeyPurposes() []KeyPurpose
func (*Options) GetWithKeyType ¶ added in v2.0.9
func (*Options) GetWithRandomBytes ¶ added in v2.0.9
func (*Options) GetWithWrappedKeyEncoding ¶ added in v2.0.9
func (x *Options) GetWithWrappedKeyEncoding() KeyEncoding
func (*Options) GetWithoutHmac ¶ added in v2.0.10
func (*Options) ProtoMessage ¶
func (*Options) ProtoMessage()
func (*Options) ProtoReflect ¶
func (x *Options) ProtoReflect() protoreflect.Message
type SigInfo ¶ added in v2.0.9
type SigInfo struct { // KeyInfo contains information about the key that was used to create this value KeyInfo *KeyInfo `protobuf:"bytes,10,opt,name=key_info,json=keyInfo,proto3" json:"key_info,omitempty"` // Signature contains the bytes of the signature // @gotags: class:"public" Signature []byte `protobuf:"bytes,20,opt,name=signature,proto3" json:"signature,omitempty" class:"public"` // HmacType (optional) defines the hmac algorithm used HmacType *HmacType `` /* 153-byte string literal not displayed */ // contains filtered or unexported fields }
SigInfo contains information about a cryptographic signature
func (*SigInfo) Descriptor
deprecated
added in
v2.0.9
func (*SigInfo) GetHmacType ¶ added in v2.0.9
func (*SigInfo) GetKeyInfo ¶ added in v2.0.9
func (*SigInfo) GetSignature ¶ added in v2.0.9
func (*SigInfo) ProtoMessage ¶ added in v2.0.9
func (*SigInfo) ProtoMessage()
func (*SigInfo) ProtoReflect ¶ added in v2.0.9
func (x *SigInfo) ProtoReflect() protoreflect.Message
type SigInfoSigner ¶ added in v2.0.9
type SigInfoSigner interface { // Sign creates a msg signature in the form of a SigInfo Sign(ctx context.Context, msg []byte, opt ...Option) (*SigInfo, error) }
SigInfoSigner defines common capabilities for creating a msg signature in the form of a SigInfo
type SigInfoVerifier ¶ added in v2.0.9
type SigInfoVerifier interface { // Verify a msg signature in the form of a SigInfo Verify(ctx context.Context, msg []byte, sig *SigInfo, opt ...Option) (bool, error) }
SigInfoVerifier defines common capabilities for verifying a msg signature in the form of a SigInfo
type TestInitFinalizer ¶
type TestInitFinalizer struct {
*TestWrapper
}
func NewTestInitFinalizer ¶
func NewTestInitFinalizer(secret []byte) *TestInitFinalizer
NewTestInitFinalizer constructs a test wrapper
type TestInitFinalizerHmacComputer ¶
type TestInitFinalizerHmacComputer struct {
*TestInitFinalizer
}
func NewTestInitFinalizerHmacComputer ¶
func NewTestInitFinalizerHmacComputer(secret []byte) *TestInitFinalizerHmacComputer
NewTestInitFinalizerHmacComputer constructs a test wrapper
type TestWrapper ¶
type TestWrapper struct { ReturnKeyIdError error ReturnDecryptError error ReturnEncryptError error // contains filtered or unexported fields }
TestWrapper is a wrapper that can be used for tests
func NewTestEnvelopeWrapper ¶
func NewTestEnvelopeWrapper(secret []byte) *TestWrapper
NewTestWrapper constructs a test wrapper
func NewTestWrapper ¶
func NewTestWrapper(secret []byte) *TestWrapper
NewTestWrapper constructs a test wrapper
func (*TestWrapper) Encrypt ¶
func (t *TestWrapper) Encrypt(ctx context.Context, plaintext []byte, opts ...Option) (*BlobInfo, error)
Encrypt allows encrypting via the test wrapper
func (*TestWrapper) HmacKeyId ¶
func (t *TestWrapper) HmacKeyId(_ context.Context) string
HmacKeyId returns the configured HMAC key ID
func (*TestWrapper) KeyBytes ¶ added in v2.0.4
func (t *TestWrapper) KeyBytes(context.Context) ([]byte, error)
KeyBytes returns the current key bytes
func (*TestWrapper) KeyId ¶
func (t *TestWrapper) KeyId(_ context.Context) (string, error)
KeyId returns the configured key ID
func (*TestWrapper) SetConfig ¶
func (t *TestWrapper) SetConfig(_ context.Context, opt ...Option) (*WrapperConfig, error)
SetConfig sets config, and currently it only supports the WithKeyId option for test wrappers
func (*TestWrapper) SetKeyId ¶
func (t *TestWrapper) SetKeyId(k string)
SetKeyID allows setting the test wrapper's key ID
func (*TestWrapper) Type ¶
func (t *TestWrapper) Type(_ context.Context) (WrapperType, error)
Type returns the type of the test wrapper
type Wrapper ¶
type Wrapper interface { // Type is the type of Wrapper Type(context.Context) (WrapperType, error) // KeyId is the ID of the key currently used for encryption KeyId(context.Context) (string, error) // SetConfig applies the given options to a wrapper and returns // configuration information. WithConfigMap will almost certainly be // required to be passed in to give wrapper-specific configuration // information to the wrapper. WithKeyId is also supported. SetConfig(ctx context.Context, options ...Option) (*WrapperConfig, error) // Encrypt encrypts the given byte slice and stores the resulting // information in the returned blob info. Which options are used depends on // the underlying wrapper. Supported options: WithAad. Encrypt(ctx context.Context, plaintext []byte, options ...Option) (*BlobInfo, error) // Decrypt decrypts the given byte slice and stores the resulting // information in the returned byte slice. Which options are used depends on // the underlying wrapper. Supported options: WithAad. Decrypt(ctx context.Context, ciphertext *BlobInfo, options ...Option) ([]byte, error) }
Wrapper is an an interface where supporting implementations allow for encrypting and decrypting data.
type WrapperConfig ¶
type WrapperConfig struct { Metadata map[string]string `` /* 158-byte string literal not displayed */ // contains filtered or unexported fields }
WrapperConfig is the result of a call to SetConfig on a wrapper, returning relevant information about the wrapper and its updated configuration
func (*WrapperConfig) Descriptor
deprecated
func (*WrapperConfig) Descriptor() ([]byte, []int)
Deprecated: Use WrapperConfig.ProtoReflect.Descriptor instead.
func (*WrapperConfig) GetMetadata ¶
func (x *WrapperConfig) GetMetadata() map[string]string
func (*WrapperConfig) ProtoMessage ¶
func (*WrapperConfig) ProtoMessage()
func (*WrapperConfig) ProtoReflect ¶
func (x *WrapperConfig) ProtoReflect() protoreflect.Message
func (*WrapperConfig) Reset ¶
func (x *WrapperConfig) Reset()
func (*WrapperConfig) String ¶
func (x *WrapperConfig) String() string
type WrapperType ¶
type WrapperType string
const ( WrapperTypeUnknown WrapperType = "unknown" WrapperTypeAead WrapperType = "aead" WrapperTypeAliCloudKms WrapperType = "alicloudkms" WrapperTypeAwsKms WrapperType = "awskms" WrapperTypeAzureKeyVault WrapperType = "azurekeyvault" WrapperTypeGcpCkms WrapperType = "gcpckms" WrapperTypeHsmAuto WrapperType = "hsm-auto" WrapperTypeHuaweiCloudKms WrapperType = "huaweicloudkms" WrapperTypeOciKms WrapperType = "ocikms" WrapperTypePkcs11 WrapperType = "pkcs11" WrapperTypePooled WrapperType = "pooled" WrapperTypeShamir WrapperType = "shamir" WrapperTypeTencentCloudKms WrapperType = "tencentcloudkms" WrapperTypeTransit WrapperType = "transit" WrapperTypeTest WrapperType = "test-auto" )
These values define known types of Wrappers
func (WrapperType) String ¶
func (t WrapperType) String() string