shared

package
v0.0.0-...-403e7f8 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EncodeBase64

func EncodeBase64[T string | []byte](pem T) []byte

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

func MustMarshalPublicKey(pub crypto.PublicKey) []byte

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.

Jump to

Keyboard shortcuts

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