pki

package
v0.13.1 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodePrivateKeyBytes

func DecodePrivateKeyBytes(keyBytes []byte) (crypto.Signer, error)

DecodePrivateKeyBytes will decode a PEM encoded private key into a crypto.Signer. It supports RSA private keys only. All other types will return err.

func GenerateCertificate

func GenerateCertificate(issuerCert *x509.Certificate, signerKey interface{}, commonName string, validFor time.Duration, isServer, isCA bool, host ...string) ([]byte, []byte, error)

GenerateCertificate issues a new certificate with the passed options and signed by the parent certificate if one is given. A self-signed is issued otherwise.

func GeneratePrivateKey

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

GeneratePrivateKey generates a new RSA private key

func IsVerifyError

func IsVerifyError(err error) bool

IsVerifyError returns true if the error has type VerifyError

func LoadX509Certificate

func LoadX509Certificate(cert []byte) (*x509.Certificate, error)

LoadX509Certificate loads a x509.Certificate object from the given bytes

func Verify

func Verify(certificate, root *x509.Certificate) error

Verify validates that the given certificate is valid and signed by the given root

Types

type VerifyError

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

VerifyError is an error type returned when the certificate does not pass validation

func NewVerifyError

func NewVerifyError(msg string) VerifyError

NewVerifyError returns a VerifyError

func (VerifyError) Error

func (vf VerifyError) Error() string

Jump to

Keyboard shortcuts

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