Documentation
¶
Index ¶
- func EncodeBase64[T string | []byte](pem T) []byte
- func MustMarshalECPrivateKey(priv *ecdsa.PrivateKey) []byte
- func MustMarshalPKCS1PrivateKey(priv *rsa.PrivateKey) []byte
- func MustMarshalPrivateKey(priv crypto.PrivateKey) []byte
- func MustMarshalPublicKey(pub crypto.PublicKey) []byte
- func ParsePrivateKey[T string | []byte](key T) (crypto.PrivateKey, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EncodeBase64 ¶
EncodeBase64 encodes given pem string or bytes to base64 bytes.
func MustMarshalECPrivateKey ¶
func MustMarshalECPrivateKey(priv *ecdsa.PrivateKey) []byte
MustMarshalPKCS1PrivateKey marshals RSA private key to PKCS1 PEM format. It panics if key is nil.
func MustMarshalPKCS1PrivateKey ¶
func MustMarshalPKCS1PrivateKey(priv *rsa.PrivateKey) []byte
MustMarshalPKCS1PrivateKey marshals RSA private key to PKCS1 PEM format. It panics if key is nil.
func MustMarshalPrivateKey ¶
func MustMarshalPrivateKey(priv crypto.PrivateKey) []byte
MustMarshalPrivateKey marshals private key to PKCS8 PEM format. It panics if crypto/x509.MarshalPKCS8PrivateKey returns an error.
func MustMarshalPublicKey ¶
MustMarshalPublicKey marshals public key to PEM format. It panics if crypto/x509.MarshalPKIXPublicKey returns an error.
func ParsePrivateKey ¶
func ParsePrivateKey[T string | []byte](key T) (crypto.PrivateKey, error)
ParsePrivateKey is a wrapper around
It can aso handle base64 encoded PEM keys.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.