Documentation
¶
Index ¶
- Constants
- Variables
- type SignerVerifier
- func (p *SignerVerifier) CreateKey(ctx context.Context, algorithm string) (crypto.PublicKey, error)
- func (p *SignerVerifier) CryptoSigner(ctx context.Context, errFunc func(error)) (crypto.Signer, crypto.SignerOpts, error)
- func (*SignerVerifier) DefaultAlgorithm() string
- func (p *SignerVerifier) PublicKey(opts ...signature.PublicKeyOption) (crypto.PublicKey, error)
- func (p *SignerVerifier) SignMessage(message io.Reader, opts ...signature.SignOption) ([]byte, error)
- func (*SignerVerifier) SupportedAlgorithms() []string
- func (p *SignerVerifier) VerifySignature(sig, message io.Reader, opts ...signature.VerifyOption) (err error)
Constants ¶
const ( CacheKey = "signer" ReferenceScheme = "pkcs11://" ConfigFileEnv = "CRYPTO11_CONFIG" )
const ( Algorithm_ECDSA_P256 = "ecdsa-p256" Algorithm_ECDSA_P384 = "ecdsa-p384" Algorithm_ECDSA_P521 = "ecdsa-p521" Algorithm_ED25519 = "ed25519" Algorithm_RSA_2048 = "rsa-2048" Algorithm_RSA_3072 = "rsa-3072" Algorithm_RSA_4096 = "rsa-4096" )
Variables ¶
var (
ErrKMSReference = errors.New("kms specification should be in the format pkcs11://LABEL")
)
Functions ¶
This section is empty.
Types ¶
type SignerVerifier ¶
type SignerVerifier struct {
// contains filtered or unexported fields
}
func LoadSignerVerifier ¶
func LoadSignerVerifier(referenceStr string) (*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 ¶
CreateKey attempts to create a new key in Vault with the specified algorithm.
func (*SignerVerifier) CryptoSigner ¶
func (p *SignerVerifier) CryptoSigner(ctx context.Context, errFunc func(error)) (crypto.Signer, crypto.SignerOpts, error)
func (*SignerVerifier) DefaultAlgorithm ¶
func (*SignerVerifier) DefaultAlgorithm() string
func (*SignerVerifier) PublicKey ¶
func (p *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 (p *SignerVerifier) SignMessage(message io.Reader, opts ...signature.SignOption) ([]byte, error)
SignMessage signs the provided message using PKCS#11. 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
func (*SignerVerifier) VerifySignature ¶
func (p *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.