keys

package
v0.17.5-rc1 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// DefaultKeyType is the default type of a private key.
	DefaultKeyType = "EC"
	// DefaultKeySize is the default size (in # of bits) of a private key.
	DefaultKeySize = 2048
	// DefaultKeyCurve is the default curve of a private key.
	DefaultKeyCurve = "P-256"
	// DefaultSignatureAlgorithm is the default signature algorithm used on a
	// certificate with the default key type.
	DefaultSignatureAlgorithm = x509.ECDSAWithSHA256
	// MinRSAKeyBytes is the minimum acceptable size (in bytes) for RSA keys
	// signed by the authority.
	MinRSAKeyBytes = 256
)

Functions

func ExtractKey added in v0.8.4

func ExtractKey(in interface{}) (interface{}, error)

ExtractKey returns the given public or private key or extracts the public key if a x509.Certificate or x509.CertificateRequest is given.

func GenerateDefaultKey

func GenerateDefaultKey() (interface{}, error)

GenerateDefaultKey generates a public/private key pair using sane defaults for key type, curve, and size.

func GenerateDefaultKeyPair

func GenerateDefaultKeyPair() (interface{}, interface{}, error)

GenerateDefaultKeyPair generates a public/private key pair using configured default values for key type, curve, and size.

func GenerateKey

func GenerateKey(kty, crv string, size int) (interface{}, error)

GenerateKey generates a key of the given type (kty).

func GenerateKeyPair

func GenerateKeyPair(kty, crv string, size int) (interface{}, interface{}, error)

GenerateKeyPair creates an asymmetric crypto keypair using input configuration.

func PublicKey

func PublicKey(priv interface{}) (interface{}, error)

PublicKey extracts a public key from a private key.

func VerifyPair added in v0.14.0

func VerifyPair(pubkey interface{}, key interface{}) error

VerifyPair that the public key matches the given private key.

Types

This section is empty.

Jump to

Keyboard shortcuts

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