x509

package
v0.0.0-...-fab57c2 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package x509 provides a mockable wrapper for crypto/x509.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Impl

type Impl struct{}

func (*Impl) CreateCertificate

func (*Impl) CreateCertificate(rand io.Reader, template *x509.Certificate, parent *x509.Certificate, pub any, priv any) ([]byte, error)

func (*Impl) CreateCertificateRequest

func (*Impl) CreateCertificateRequest(rand io.Reader, template *x509.CertificateRequest, priv any) (csr []byte, err error)

func (*Impl) CreateRevocationList

func (*Impl) CreateRevocationList(rand io.Reader, template *x509.RevocationList, issuer *x509.Certificate, priv crypto.Signer) ([]byte, error)

func (*Impl) DecryptPEMBlock

func (*Impl) DecryptPEMBlock(b *pem.Block, password []byte) ([]byte, error)

func (*Impl) EncryptPEMBlock

func (*Impl) EncryptPEMBlock(rand io.Reader, blockType string, data []byte, password []byte, alg x509.PEMCipher) (*pem.Block, error)

func (*Impl) IsEncryptedPEMBlock

func (*Impl) IsEncryptedPEMBlock(b *pem.Block) bool

func (*Impl) MarshalECPrivateKey

func (*Impl) MarshalECPrivateKey(key *ecdsa.PrivateKey) ([]byte, error)

func (*Impl) MarshalPKCS1PrivateKey

func (*Impl) MarshalPKCS1PrivateKey(key *rsa.PrivateKey) []byte

func (*Impl) MarshalPKCS1PublicKey

func (*Impl) MarshalPKCS1PublicKey(key *rsa.PublicKey) []byte

func (*Impl) MarshalPKCS8PrivateKey

func (*Impl) MarshalPKCS8PrivateKey(key any) ([]byte, error)

func (*Impl) MarshalPKIXPublicKey

func (*Impl) MarshalPKIXPublicKey(pub any) ([]byte, error)

func (*Impl) NewCertPool

func (*Impl) NewCertPool() *x509.CertPool

func (*Impl) ParseCRL

func (*Impl) ParseCRL(crlBytes []byte) (*pkix.CertificateList, error)

func (*Impl) ParseCertificate

func (*Impl) ParseCertificate(der []byte) (*x509.Certificate, error)

func (*Impl) ParseCertificateRequest

func (*Impl) ParseCertificateRequest(asn1Data []byte) (*x509.CertificateRequest, error)

func (*Impl) ParseCertificates

func (*Impl) ParseCertificates(der []byte) ([]*x509.Certificate, error)

func (*Impl) ParseDERCRL

func (*Impl) ParseDERCRL(derBytes []byte) (*pkix.CertificateList, error)

func (*Impl) ParseECPrivateKey

func (*Impl) ParseECPrivateKey(der []byte) (*ecdsa.PrivateKey, error)

func (*Impl) ParsePKCS1PrivateKey

func (*Impl) ParsePKCS1PrivateKey(der []byte) (*rsa.PrivateKey, error)

func (*Impl) ParsePKCS1PublicKey

func (*Impl) ParsePKCS1PublicKey(der []byte) (*rsa.PublicKey, error)

func (*Impl) ParsePKCS8PrivateKey

func (*Impl) ParsePKCS8PrivateKey(der []byte) (key any, err error)

func (*Impl) ParsePKIXPublicKey

func (*Impl) ParsePKIXPublicKey(derBytes []byte) (pub any, err error)

func (*Impl) SystemCertPool

func (*Impl) SystemCertPool() (*x509.CertPool, error)

type Interface

type Interface interface {
	CreateCertificate(rand io.Reader, template *x509.Certificate, parent *x509.Certificate, pub any, priv any) ([]byte, error)
	CreateCertificateRequest(rand io.Reader, template *x509.CertificateRequest, priv any) (csr []byte, err error)
	CreateRevocationList(rand io.Reader, template *x509.RevocationList, issuer *x509.Certificate, priv crypto.Signer) ([]byte, error)
	DecryptPEMBlock(b *pem.Block, password []byte) ([]byte, error)
	EncryptPEMBlock(rand io.Reader, blockType string, data []byte, password []byte, alg x509.PEMCipher) (*pem.Block, error)
	IsEncryptedPEMBlock(b *pem.Block) bool
	MarshalECPrivateKey(key *ecdsa.PrivateKey) ([]byte, error)
	MarshalPKCS1PrivateKey(key *rsa.PrivateKey) []byte
	MarshalPKCS1PublicKey(key *rsa.PublicKey) []byte
	MarshalPKCS8PrivateKey(key any) ([]byte, error)
	MarshalPKIXPublicKey(pub any) ([]byte, error)
	NewCertPool() *x509.CertPool
	ParseCRL(crlBytes []byte) (*pkix.CertificateList, error)
	ParseCertificate(der []byte) (*x509.Certificate, error)
	ParseCertificateRequest(asn1Data []byte) (*x509.CertificateRequest, error)
	ParseCertificates(der []byte) ([]*x509.Certificate, error)
	ParseDERCRL(derBytes []byte) (*pkix.CertificateList, error)
	ParseECPrivateKey(der []byte) (*ecdsa.PrivateKey, error)
	ParsePKCS1PrivateKey(der []byte) (*rsa.PrivateKey, error)
	ParsePKCS1PublicKey(der []byte) (*rsa.PublicKey, error)
	ParsePKCS8PrivateKey(der []byte) (key any, err error)
	ParsePKIXPublicKey(derBytes []byte) (pub any, err error)
	SystemCertPool() (*x509.CertPool, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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