Documentation
¶
Index ¶
- Variables
- func CheckExpiration(cert *x509.Certificate, epoch time.Time) error
- func GeneratePEMEncodedECDSAKeyPair(curve elliptic.Curve, pf PassFunc) (privPEM, pubPEM []byte, err error)
- func GeneratePEMEncodedRSAKeyPair(keyLengthBits int, pf PassFunc) (privPEM, pubPEM []byte, err error)
- func GetPasswordFromStdIn(confirm bool) ([]byte, error)
- func LoadCertificatesFromPEM(pem io.Reader) ([]*x509.Certificate, error)
- func MarshalCertificateToPEM(cert *x509.Certificate) ([]byte, error)
- func MarshalCertificatesToPEM(certs []*x509.Certificate) ([]byte, error)
- func MarshalPrivateKeyToDER(priv crypto.PrivateKey) ([]byte, error)
- func MarshalPrivateKeyToEncryptedDER(priv crypto.PrivateKey, pf PassFunc) ([]byte, error)
- func MarshalPrivateKeyToPEM(priv crypto.PrivateKey) ([]byte, error)
- func MarshalPublicKeyToDER(pub crypto.PublicKey) ([]byte, error)
- func MarshalPublicKeyToPEM(pub crypto.PublicKey) ([]byte, error)
- func PEMEncode(typeStr PEMType, bytes []byte) []byte
- func SkipPassword(_ bool) ([]byte, error)
- func UnmarshalCertificatesFromPEM(pemBytes []byte) ([]*x509.Certificate, error)
- func UnmarshalPEMToPrivateKey(pemBytes []byte, pf PassFunc) (crypto.PrivateKey, error)
- func UnmarshalPEMToPublicKey(pemBytes []byte) (crypto.PublicKey, error)
- type PEMType
- type PassFunc
Constants ¶
This section is empty.
Variables ¶
var (
// Read is for fuzzing
Read = readPasswordFn
)
Functions ¶
func CheckExpiration ¶
func CheckExpiration(cert *x509.Certificate, epoch time.Time) error
CheckExpiration verifies that epoch is during the validity period of the certificate provided.
It returns nil if issueTime < epoch < expirationTime, and error otherwise.
func GeneratePEMEncodedECDSAKeyPair ¶
func GeneratePEMEncodedECDSAKeyPair(curve elliptic.Curve, pf PassFunc) (privPEM, pubPEM []byte, err error)
GeneratePEMEncodedECDSAKeyPair generates an ECDSA keypair, optionally password encrypted using a provided PassFunc, and PEM encoded.
func GeneratePEMEncodedRSAKeyPair ¶
func GeneratePEMEncodedRSAKeyPair(keyLengthBits int, pf PassFunc) (privPEM, pubPEM []byte, err error)
GeneratePEMEncodedRSAKeyPair generates an RSA keypair, optionally password encrypted using a provided PassFunc, and PEM encoded.
func GetPasswordFromStdIn ¶
GetPasswordFromStdIn gathers the password from stdin with an optional confirmation step.
func LoadCertificatesFromPEM ¶
func LoadCertificatesFromPEM(pem io.Reader) ([]*x509.Certificate, error)
LoadCertificatesFromPEMFile extracts one or more X509 certificates from the provided io.Reader.
func MarshalCertificateToPEM ¶
func MarshalCertificateToPEM(cert *x509.Certificate) ([]byte, error)
MarshalCertificateToPEM converts the provided X509 certificate into PEM format
func MarshalCertificatesToPEM ¶
func MarshalCertificatesToPEM(certs []*x509.Certificate) ([]byte, error)
MarshalCertificatesToPEM converts the provided X509 certificates into PEM format
func MarshalPrivateKeyToDER ¶
func MarshalPrivateKeyToDER(priv crypto.PrivateKey) ([]byte, error)
MarshalPrivateKeyToDER converts a crypto.PrivateKey into a PKCS8 ASN.1 DER byte slice
func MarshalPrivateKeyToEncryptedDER ¶
func MarshalPrivateKeyToEncryptedDER(priv crypto.PrivateKey, pf PassFunc) ([]byte, error)
func MarshalPrivateKeyToPEM ¶
func MarshalPrivateKeyToPEM(priv crypto.PrivateKey) ([]byte, error)
MarshalPrivateKeyToPEM converts a crypto.PrivateKey into a PEM-encoded byte slice
func MarshalPublicKeyToDER ¶
MarshalPublicKeyToDER converts a crypto.PublicKey into a PKIX, ASN.1 DER byte slice
func MarshalPublicKeyToPEM ¶
MarshalPublicKeyToPEM converts a crypto.PublicKey into a PEM-encoded byte slice
func SkipPassword ¶
SkipPassword is a PassFunc that does not interact with a user, but simply returns nil for both the password result and error struct.
func UnmarshalCertificatesFromPEM ¶
func UnmarshalCertificatesFromPEM(pemBytes []byte) ([]*x509.Certificate, error)
UnmarshalCertificatesFromPEM extracts one or more X509 certificates from the provided byte slice, which is assumed to be in PEM-encoded format.
func UnmarshalPEMToPrivateKey ¶
func UnmarshalPEMToPrivateKey(pemBytes []byte, pf PassFunc) (crypto.PrivateKey, error)
UnmarshalPEMToPrivateKey converts a PEM-encoded byte slice into a crypto.PrivateKey