Documentation ¶
Index ¶
Constants ¶
const ( // KeystoreEndpoint represents a remote keystore endpoint with swappable {serverEndpoint} value. KeystoreEndpoint = "{serverEndpoint}/v1/keystores" // ContentType is remoteKMS http content-type. ContentType = "application/json" )
Variables ¶
This section is empty.
Functions ¶
func CreateKeyStore ¶
func CreateKeyStore(httpClient HTTPClient, keyserverURL, controller, vaultURL string, capability []byte, opts ...Opt) (string, []byte, error)
CreateKeyStore calls the key server's create keystore REST function and returns the resulting keystoreURL value. Arguments of this function are described below:
- httpClient used to POST the request
- keyserverURL representing the key server url
- marshaller the marshal function used for marshaling content in the client. Usually: `json.Marshal`
- headersOpt optional function setting any necessary http headers for key server authorization
Returns:
- keystore URL (if successful)
- error (if error encountered)
Types ¶
type CryptoBox ¶
CryptoBox provides an elliptic-curve-based authenticated encryption scheme executed on a remote key server
Payloads are encrypted using symmetric encryption (XChacha20Poly1305) using a shared key derived from a shared secret created by Curve25519 Elliptic Curve Diffie-Hellman key exchange.
CryptoBox is created by a remote KMS, and remotely reads secret keys from the KMS for encryption/decryption, so clients do not need to see the secrets themselves.
func NewCryptoBox ¶
func NewCryptoBox(w kms.KeyManager) (*CryptoBox, error)
NewCryptoBox creates a CryptoBox which provides remote crypto box encryption using the given KMS's key.
type HTTPClient ¶ added in v0.1.6
HTTPClient interface for the http client.
type Opt ¶
Opt are the remoteKMS option.
func WithHeaders ¶
func WithHeaders(addHeadersFunc webkms.AddHeaders) Opt
WithHeaders option is for setting additional http request headers (since it's a function, it can call a remote authorization server to fetch the necessary info needed in these headers).
func WithMarshalFn ¶ added in v0.1.6
func WithMarshalFn(fn marshalFunc) Opt
WithMarshalFn allows providing marshal function.