kms

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Auth

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

Auth holds the configuration for authentication with a KMS server.

cert: the path to the client certificate file. key: the path to the client key file. cacert: the path to the CA certificate file.

func NewClientCertificateAuth

func NewClientCertificateAuth(cert, key, cacert string) *Auth

NewClientCertificateAuth creates a new instance of the Auth struct for client certificate authentication.

Parameters: - cert: the path to the client certificate file. - key: the path to the client key file. - cacert: the path to the CA certificate file.

Returns: - *Auth: a pointer to the Auth struct, or nil if any of the parameters are empty.

func (*Auth) IsClientCertAuth

func (a *Auth) IsClientCertAuth() bool

IsClientCertAuth checks if the Auth struct has a valid client certificate, key, and CA certificate.

Returns: - bool: true if all fields are non-nil, false otherwise.

type KMSHandler

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

KMSHandler is a client for a kms KMS (Key Management Service)

func NewKMSServer

func NewKMSServer(url string, timeout int, kmsAuth *Auth) *KMSHandler

NewKMSServer creates a new KMSHandler instance for interacting with a KMS server.

Parameters: - url: the URL of the KMS server. - timeout: the timeout duration for HTTP requests in seconds. - kmsAuth: the authentication configuration for the KMS server.

Returns: - *KMSHandler: a pointer to the KMSHandler instance.

func (*KMSHandler) GetKeyByID

func (q *KMSHandler) GetKeyByID(keyID string) (*Key, error)

GetKeyByID fetches a key from a KMS by its ID.

keyID string *Key, error

func (*KMSHandler) GetNewKey

func (q *KMSHandler) GetNewKey() (*Key, error)

GetNewKey fetches a new key from the KMS.

No parameters. Returns a pointer to a Key struct and an error.

type Key

type Key struct {
	ID  string `json:"key_ID"`
	Key string `json:"key"`
}

Key is a KMS generated key.

ID is the ID of the key, used to identify it in a KMS system. Key is the generated key itself.

func (*Key) GetID

func (k *Key) GetID() string

GetID returns the key ID from the KMS generated key.

No parameters. Returns a string.

func (*Key) GetKey

func (k *Key) GetKey() string

GetKey returns the KMS generated key.

No parameters. Returns a string.

Jump to

Keyboard shortcuts

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