aws

package
v0.0.0-...-d338334 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2022 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

Package aws implement the interface with amazon aws kms service

Package aws contains utilities related to AWS KMS.

Index

Constants

View Source
const (

	// ReferenceScheme schemes for various KMS services are copied from https://github.com/google/go-cloud/tree/master/secrets
	ReferenceScheme = "awskms://"
)

Variables

This section is empty.

Functions

func ParseReference

func ParseReference(resourceID string) (endpoint, keyID, alias string, err error)

ParseReference parses an awskms-scheme URI into its constituent parts.

func ValidReference

func ValidReference(ref string) error

ValidReference returns a non-nil error if the reference string is invalid

Types

type SignerVerifier

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

SignerVerifier is a signature.SignerVerifier that uses the AWS Key Management Service

func LoadSignerVerifier

func LoadSignerVerifier(ctx context.Context, referenceStr string, opts ...func(*config.LoadOptions) error) (*SignerVerifier, error)

LoadSignerVerifier generates signatures using the specified key object in AWS KMS and hash algorithm.

It also can verify signatures locally using the public key. hashFunc must not be crypto.Hash(0).

func (*SignerVerifier) CreateKey

func (a *SignerVerifier) CreateKey(ctx context.Context, algorithm string) (crypto.PublicKey, error)

CreateKey attempts to create a new key in Vault with the specified algorithm.

func (*SignerVerifier) CryptoSigner

func (a *SignerVerifier) CryptoSigner(ctx context.Context, errFunc func(error)) (crypto.Signer, crypto.SignerOpts, error)

CryptoSigner returns a crypto.Signer object that uses the underlying SignerVerifier, along with a crypto.SignerOpts object that allows the KMS to be used in APIs that only accept the standard golang objects

func (*SignerVerifier) DefaultAlgorithm

func (*SignerVerifier) DefaultAlgorithm() string

DefaultAlgorithm returns the default algorithm for the AWS KMS service

func (*SignerVerifier) PublicKey

func (a *SignerVerifier) PublicKey(opts ...signature.PublicKeyOption) (crypto.PublicKey, error)

PublicKey returns the public key that can be used to verify signatures created by this signer. If the caller wishes to specify the context to use to obtain the public key, pass option.WithContext(desiredCtx).

All other options are ignored if specified.

func (*SignerVerifier) SignMessage

func (a *SignerVerifier) SignMessage(message io.Reader, opts ...signature.SignOption) ([]byte, error)

SignMessage signs the provided message using AWS KMS. If the message is provided, this method will compute the digest according to the hash function specified when the Signer was created.

SignMessage recognizes the following Options listed in order of preference:

- WithContext()

- WithDigest()

- WithCryptoSignerOpts()

All other options are ignored if specified.

func (*SignerVerifier) SupportedAlgorithms

func (*SignerVerifier) SupportedAlgorithms() []string

SupportedAlgorithms returns the list of algorithms supported by the AWS KMS service

func (*SignerVerifier) VerifySignature

func (a *SignerVerifier) VerifySignature(sig, message io.Reader, opts ...signature.VerifyOption) (err error)

VerifySignature verifies the signature for the given message. Unless provided in an option, the digest of the message will be computed using the hash function specified when the SignerVerifier was created.

This function returns nil if the verification succeeded, and an error message otherwise.

This function recognizes the following Options listed in order of preference:

- WithContext()

- WithDigest()

- WithRemoteVerification()

- WithCryptoSignerOpts()

All other options are ignored if specified.

Jump to

Keyboard shortcuts

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