crtutil

package
v0.1.23 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package crtutil is common certificate related utils for Go.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoPEMData      = errors.New("no pem data is found")
	ErrUnknownKeyType = errors.New("unknown private key type in PKCS#8 wrapping")
)

Functions

func CertChainToPEM

func CertChainToPEM(chain []*x509.Certificate) ([]byte, error)

CertChainToPEM converts a slice of x509.Certificate into PEM block, in the order they are passed. Deprecated: use EncodeX509ChainToPEM instead.

func CertToPEM

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

CertToPEM converts a x509.Certificate into a PEM block. Deprecated: use EncodeX509ToPEM instead.

func EncodeX509ChainToPEM added in v0.1.23

func EncodeX509ChainToPEM(chain []*x509.Certificate, headers map[string]string) ([]byte, error)

EncodeX509ChainToPEM converts a slice of x509.Certificate into PEM block, in the order they are passed.

func EncodeX509ToPEM added in v0.1.23

func EncodeX509ToPEM(cert *x509.Certificate, headers map[string]string) []byte

EncodeX509ToPEM converts a x509.Certificate into a PEM block.

func ParseCertBytes

func ParseCertBytes(data []byte) (*x509.Certificate, error)

ParseCertBytes parses a single x509.Certificate from the given data. The data is expected to be PEM Encoded and contain one certificate with PEM type "CERTIFICATE". Deprecated: use ReadBytesAsX509 instead.

func ParseCertChainBytes

func ParseCertChainBytes(data []byte) ([]*x509.Certificate, error)

ParseCertChainBytes parses x509.Certificate chain from the given data. The data is expected to be PEM Encoded and contain one of more certificates with PEM type "CERTIFICATE". Deprecated: use ReadChainBytesAsX509 instead.

func ParseCertChainFile

func ParseCertChainFile(fpath string) ([]*x509.Certificate, error)

ParseCertChainFile parses the x509.Certificate chain from the given file. The data is expected to be PEM Encoded and contain one of more certificates with PEM type "CERTIFICATE". Deprecated: use ReadChainFileAsX509 instead.

func ParseCertFile

func ParseCertFile(fpath string) (*x509.Certificate, error)

ParseCertFile parses x509.Certificate from the given file. The data is expected to be PEM Encoded and contain one certificate with PEM type "CERTIFICATE". Deprecated: use ReadFileAsX509 instead.

func ParseKeyBytes

func ParseKeyBytes(data []byte, isBase64 bool) (crypto.PrivateKey, error)

ParseKeyBytes parses an unencrypted crypto.PrivateKey from the given data.

func ParseKeyFile

func ParseKeyFile(fpath string) (crypto.PrivateKey, error)

ParseKeyFile parses an unencrypted crypto.PrivateKey from the given file.

func ParseKeyFileWithPass

func ParseKeyFileWithPass(keyPath, keyPass string) (crypto.PrivateKey, error)

ParseKeyFileWithPass parses an unencrypted crypto.PrivateKey from the given file.

func ReadBytesAsX509 added in v0.1.23

func ReadBytesAsX509(data []byte) (*x509.Certificate, error)

ReadBytesAsX509 read x509.Certificate from the given data. The data is expected to be PEM Encoded and contain one certificate with PEM type "CERTIFICATE".

func ReadChainBytesAsX509 added in v0.1.23

func ReadChainBytesAsX509(data []byte) ([]*x509.Certificate, error)

ReadChainBytesAsX509 read x509.Certificate chain from the given data. The data is expected to be PEM Encoded and contain one of more certificates with PEM type "CERTIFICATE".

func ReadChainFileAsX509 added in v0.1.23

func ReadChainFileAsX509(fpath string) ([]*x509.Certificate, error)

ReadChainFileAsX509 read the x509.Certificate chain from the given file. The data is expected to be PEM Encoded and contain one of more certificates with PEM type "CERTIFICATE".

func ReadFileAsX509 added in v0.1.23

func ReadFileAsX509(fpath string) (*x509.Certificate, error)

ReadFileAsX509 read x509.Certificate from the given file. The data is expected to be PEM Encoded and contain one certificate with PEM type "CERTIFICATE".

Types

This section is empty.

Jump to

Keyboard shortcuts

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