pmemtls

package
v0.7.25 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2020 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeCert

func DecodeCert(encodedCert []byte) (*x509.Certificate, error)

DecodeCert return the decoded certificate of given encodedCert

func DecodeKey

func DecodeKey(encodedKey []byte) (*rsa.PrivateKey, error)

DecodeKey returns the decoded private key of given encodedKey

func EncodeCert

func EncodeCert(cert *x509.Certificate) []byte

EncodeCert returns PEM encoding of given cert

func EncodeKey

func EncodeKey(key *rsa.PrivateKey) []byte

EncodeKey returns PEM encoding of give private key

func NewCACertificate

func NewCACertificate(key *rsa.PrivateKey) (*x509.Certificate, error)

NewCACertificate returns a self-signed certificate used as certificate authority

func NewPrivateKey

func NewPrivateKey() (*rsa.PrivateKey, error)

NewPrivateKey generate an rsa private key

Types

type CA

type CA struct {
	// contains filtered or unexported fields
}

CA type representation for a self-signed certificate authority

func NewCA

func NewCA(caCert *x509.Certificate, key *rsa.PrivateKey) (*CA, error)

NewCA creates a new CA object for given CA certificate and private key. If both of caCert and key are nil, generates a new private key and a self-signed certificate

func (*CA) Certificate

func (ca *CA) Certificate() *x509.Certificate

Certificate returns root ca certificate used

func (*CA) EncodedCertificate

func (ca *CA) EncodedCertificate() []byte

EncodedCertificate returns encoded root ca certificate used

func (*CA) EncodedKey

func (ca *CA) EncodedKey() []byte

EncodedKey returns encoded private key used

func (*CA) GenerateCertificate

func (ca *CA) GenerateCertificate(cn string, key crypto.PublicKey) (*x509.Certificate, error)

GenerateCertificate returns a new certificate signed for given public key.

func (*CA) GenerateCertificateWithDuration

func (ca *CA) GenerateCertificateWithDuration(cn string, notBefore, notAfter time.Time, key crypto.PublicKey) (*x509.Certificate, error)

GenerateCertificateWithDuration returns a new certificate signed for given public key. The duration of this certificate is with in the given notBefore and notAfter bounds. Intended use of this API is only by tests

func (*CA) PrivateKey

func (ca *CA) PrivateKey() *rsa.PrivateKey

PrivateKey returns private key used

Jump to

Keyboard shortcuts

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