cert

package
v0.0.0-...-243feeb Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2024 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Certs

type Certs struct {
	Root          *x509.Certificate
	Intermediates []*x509.Certificate
}

func New

func New(data []string) (*Certs, error)

New creates a Certs struct by decoding the data in base64 Note that Certs is guaranteed to be non-nil when there is no error

func (*Certs) ToPEM

func (c *Certs) ToPEM() (ret []byte)

ToPEM converts the certs to PEM by first converting the intermediate certificates and then the root certificate

type ClientCert

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

ClientCert is the client certificate structure

func NewClientCert

func NewClientCert(pkcs12s string, pass string, b64 bool) (*ClientCert, error)

NewClientCert creates a new client certificate using the pkcs12 string 'pkcs12s' and passphrase 'pass' It returns the client certificate object and an error itself

func (*ClientCert) PrivateKeyPEMEnc

func (cc *ClientCert) PrivateKeyPEMEnc() (pemb []byte, pwd string, err error)

PrivateKeyPEMEnc gets the private key in encrypted PEM format It returns the PEM format for the private key, the password protecting it and an error The password is automatically generated by generating random bytes using crypto/rand ... and then feeding it to base64 encoding

func (*ClientCert) ToPEM

func (cc *ClientCert) ToPEM() []byte

ToPEM generates the PEM bytes for the client certificate

func (*ClientCert) Validity

func (cc *ClientCert) Validity() time.Time

Validity returns until when the client certificate is valid Before this time the certificate should thus be renewed by running the client again

Jump to

Keyboard shortcuts

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