pki

package
v1.0.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// EllipticCurve is the default curve used for key generation
	EllipticCurve = elliptic.P256()
)

Functions

func MarshalCertificate

func MarshalCertificate(crt *x509.Certificate) ([]byte, error)

MarshalCertificate returns PEM encoding of crt

func MarshalPrivateKey

func MarshalPrivateKey(key crypto.PrivateKey) ([]byte, error)

MarshalPrivateKey returns PEM encoding of key

func MarshalPublicKey

func MarshalPublicKey(key crypto.PublicKey) ([]byte, error)

MarshalPublicKey returns PEM encoding of key

func MarshalPublicKeySSH

func MarshalPublicKeySSH(key crypto.PublicKey) ([]byte, error)

MarshalPublicKeySSH returns OpenSSH encoding of key

func NewPrivateKey

func NewPrivateKey() (crypto.PrivateKey, error)

NewPrivateKey generates new private key using `EllipticCurve`

func ReadCertificate

func ReadCertificate(filename string) (*x509.Certificate, error)

ReadCertificate loads certificate from file

func ReadPrivateKey

func ReadPrivateKey(filename string) (crypto.PrivateKey, error)

ReadPrivateKey loads private key from file

func UnmarshalCertificate

func UnmarshalCertificate(raw []byte) (*x509.Certificate, error)

UnmarshalCertificate parses certificate from PEM-encoded bytes

func UnmarshalPrivateKey

func UnmarshalPrivateKey(raw []byte) (crypto.PrivateKey, error)

UnmarshalPrivateKey parses private key from PEM-encoded bytes

func WriteCertificate

func WriteCertificate(filename string, crt *x509.Certificate) error

WriteCertificate saves certificate to file

func WritePrivateKey

func WritePrivateKey(filename string, key crypto.PrivateKey) error

WritePrivateKey saves private key to file

func WritePublicKey

func WritePublicKey(filename string, key crypto.PublicKey) error

WritePublicKey saves public key to file

func WritePublicKeySSH

func WritePublicKeySSH(filename string, key crypto.PublicKey) error

WritePublicKeySSH saves public key to file in OpenSSH format

Types

This section is empty.

Jump to

Keyboard shortcuts

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