kms

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EncryptionService_Encrypt_FullMethodName = "/api.kms.v1.EncryptionService/Encrypt"
	EncryptionService_Decrypt_FullMethodName = "/api.kms.v1.EncryptionService/Decrypt"
)

Variables

View Source
var EncryptionService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "api.kms.v1.EncryptionService",
	HandlerType: (*EncryptionServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Encrypt",
			Handler:    _EncryptionService_Encrypt_Handler,
		},
		{
			MethodName: "Decrypt",
			Handler:    _EncryptionService_Decrypt_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "api/kms/v1/service.proto",
}

EncryptionService_ServiceDesc is the grpc.ServiceDesc for EncryptionService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

View Source
var File_api_kms_v1_decrypt_proto protoreflect.FileDescriptor
View Source
var File_api_kms_v1_encrypt_proto protoreflect.FileDescriptor
View Source
var File_api_kms_v1_service_proto protoreflect.FileDescriptor

Functions

func RegisterEncryptionServiceServer

func RegisterEncryptionServiceServer(s grpc.ServiceRegistrar, srv EncryptionServiceServer)

Types

type DecryptRequest

type DecryptRequest struct {

	// ciphertext is the wrapped key material to unwrap. It carries whatever the
	// provider needs to locate the key that produced it.
	Ciphertext []byte `protobuf:"bytes,1,opt,name=ciphertext,proto3" json:"ciphertext,omitempty"`
	// contains filtered or unexported fields
}

DecryptRequest asks the provider to unwrap ciphertext produced by a prior Encrypt call.

func (*DecryptRequest) Descriptor deprecated

func (*DecryptRequest) Descriptor() ([]byte, []int)

Deprecated: Use DecryptRequest.ProtoReflect.Descriptor instead.

func (*DecryptRequest) GetCiphertext

func (x *DecryptRequest) GetCiphertext() []byte

func (*DecryptRequest) ProtoMessage

func (*DecryptRequest) ProtoMessage()

func (*DecryptRequest) ProtoReflect

func (x *DecryptRequest) ProtoReflect() protoreflect.Message

func (*DecryptRequest) Reset

func (x *DecryptRequest) Reset()

func (*DecryptRequest) String

func (x *DecryptRequest) String() string

type DecryptResponse

type DecryptResponse struct {

	// plaintext is the original key material recovered from the request's
	// ciphertext.
	Plaintext []byte `protobuf:"bytes,1,opt,name=plaintext,proto3" json:"plaintext,omitempty"`
	// contains filtered or unexported fields
}

DecryptResponse returns the unwrapped key material.

func (*DecryptResponse) Descriptor deprecated

func (*DecryptResponse) Descriptor() ([]byte, []int)

Deprecated: Use DecryptResponse.ProtoReflect.Descriptor instead.

func (*DecryptResponse) GetPlaintext

func (x *DecryptResponse) GetPlaintext() []byte

func (*DecryptResponse) ProtoMessage

func (*DecryptResponse) ProtoMessage()

func (*DecryptResponse) ProtoReflect

func (x *DecryptResponse) ProtoReflect() protoreflect.Message

func (*DecryptResponse) Reset

func (x *DecryptResponse) Reset()

func (*DecryptResponse) String

func (x *DecryptResponse) String() string

type EncryptRequest

type EncryptRequest struct {

	// namespace is the pre-translation (local) namespace the DEK belongs to. A
	// provider may use it to select a per-namespace wrapping key.
	Namespace string `protobuf:"bytes,1,opt,name=namespace,proto3" json:"namespace,omitempty"`
	// plaintext is the key material to wrap (a DEK in the proxy's envelope
	// encryption scheme).
	Plaintext []byte `protobuf:"bytes,2,opt,name=plaintext,proto3" json:"plaintext,omitempty"`
	// contains filtered or unexported fields
}

EncryptRequest asks the provider to wrap key material under the key selected for the given namespace.

func (*EncryptRequest) Descriptor deprecated

func (*EncryptRequest) Descriptor() ([]byte, []int)

Deprecated: Use EncryptRequest.ProtoReflect.Descriptor instead.

func (*EncryptRequest) GetNamespace

func (x *EncryptRequest) GetNamespace() string

func (*EncryptRequest) GetPlaintext

func (x *EncryptRequest) GetPlaintext() []byte

func (*EncryptRequest) ProtoMessage

func (*EncryptRequest) ProtoMessage()

func (*EncryptRequest) ProtoReflect

func (x *EncryptRequest) ProtoReflect() protoreflect.Message

func (*EncryptRequest) Reset

func (x *EncryptRequest) Reset()

func (*EncryptRequest) String

func (x *EncryptRequest) String() string

type EncryptResponse

type EncryptResponse struct {

	// ciphertext is the wrapped form of the request's plaintext. It should carry
	// whatever the provider needs to later identify the wrapping key, so that
	// Decrypt can unwrap it.
	Ciphertext []byte `protobuf:"bytes,1,opt,name=ciphertext,proto3" json:"ciphertext,omitempty"`
	// contains filtered or unexported fields
}

EncryptResponse returns the wrapped key material.

func (*EncryptResponse) Descriptor deprecated

func (*EncryptResponse) Descriptor() ([]byte, []int)

Deprecated: Use EncryptResponse.ProtoReflect.Descriptor instead.

func (*EncryptResponse) GetCiphertext

func (x *EncryptResponse) GetCiphertext() []byte

func (*EncryptResponse) ProtoMessage

func (*EncryptResponse) ProtoMessage()

func (*EncryptResponse) ProtoReflect

func (x *EncryptResponse) ProtoReflect() protoreflect.Message

func (*EncryptResponse) Reset

func (x *EncryptResponse) Reset()

func (*EncryptResponse) String

func (x *EncryptResponse) String() string

type EncryptionServiceClient

type EncryptionServiceClient interface {
	// Encrypt wraps the supplied key material and returns its ciphertext. The
	// namespace selects which key the provider wraps with, letting a single
	// provider serve per-namespace keys.
	Encrypt(ctx context.Context, in *EncryptRequest, opts ...grpc.CallOption) (*EncryptResponse, error)
	// Decrypt unwraps ciphertext previously produced by Encrypt and returns the
	// original key material. The ciphertext is expected to be self-describing so
	// the provider can identify the key that produced it.
	Decrypt(ctx context.Context, in *DecryptRequest, opts ...grpc.CallOption) (*DecryptResponse, error)
}

EncryptionServiceClient is the client API for EncryptionService service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

EncryptionService is the contract for a pluggable Key Management Service (KMS) provider. The proxy ships with built-in providers backed by cloud KMS (awskms, azurekeyvault, gcpkms) and a local testing key. An operator who needs a backend the proxy does not support natively (for example, an on-prem HSM or an internal key service) can instead run their own provider as a gRPC server implementing this service and point the proxy at it.

The service plays the role of a Key Encryption Key (KEK): it wraps and unwraps the data encryption keys (DEKs) the proxy uses to seal payloads. It operates only on DEK material and never sees plaintext payloads.

type EncryptionServiceServer

type EncryptionServiceServer interface {
	// Encrypt wraps the supplied key material and returns its ciphertext. The
	// namespace selects which key the provider wraps with, letting a single
	// provider serve per-namespace keys.
	Encrypt(context.Context, *EncryptRequest) (*EncryptResponse, error)
	// Decrypt unwraps ciphertext previously produced by Encrypt and returns the
	// original key material. The ciphertext is expected to be self-describing so
	// the provider can identify the key that produced it.
	Decrypt(context.Context, *DecryptRequest) (*DecryptResponse, error)
	// contains filtered or unexported methods
}

EncryptionServiceServer is the server API for EncryptionService service. All implementations must embed UnimplementedEncryptionServiceServer for forward compatibility.

EncryptionService is the contract for a pluggable Key Management Service (KMS) provider. The proxy ships with built-in providers backed by cloud KMS (awskms, azurekeyvault, gcpkms) and a local testing key. An operator who needs a backend the proxy does not support natively (for example, an on-prem HSM or an internal key service) can instead run their own provider as a gRPC server implementing this service and point the proxy at it.

The service plays the role of a Key Encryption Key (KEK): it wraps and unwraps the data encryption keys (DEKs) the proxy uses to seal payloads. It operates only on DEK material and never sees plaintext payloads.

type UnimplementedEncryptionServiceServer

type UnimplementedEncryptionServiceServer struct{}

UnimplementedEncryptionServiceServer must be embedded to have forward compatible implementations.

NOTE: this should be embedded by value instead of pointer to avoid a nil pointer dereference when methods are called.

func (UnimplementedEncryptionServiceServer) Decrypt

func (UnimplementedEncryptionServiceServer) Encrypt

type UnsafeEncryptionServiceServer

type UnsafeEncryptionServiceServer interface {
	// contains filtered or unexported methods
}

UnsafeEncryptionServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to EncryptionServiceServer will result in compilation errors.

Jump to

Keyboard shortcuts

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