cert

package
v0.0.0-...-42ab66e Latest Latest
Warning

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

Go to latest
Published: May 3, 2024 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrDecodeCACert = errors.New("Can't decode CA cert file")

Functions

func CRLInfo

func CRLInfo(rl *x509.RevocationList) string

func CertInfo

func CertInfo(cert *x509.Certificate) string

CertInfo returns certificate information

func GetPublicKey

func GetPublicKey(pub interface{}) (string, error)

GetPublicKey returns string of pem encoded structure from given public key

func GetSerial

func GetSerial() (*big.Int, error)

GetSerial returns serial and an error

func ParseCRL

func ParseCRL(crl []byte) (*x509.RevocationList, error)

func ParseCertificate

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

ParseCertificate returns parsed certificate and error

func ParsePrivateKey

func ParsePrivateKey(pkey []byte) (*ecdsa.PrivateKey, error)

ParsePrivatekey parse given []byte private key to struct *ecdsa.PrivateKey

Types

type CertRevocationList

type CertRevocationList struct {
	Byte []byte
}

CertRevocationList hold certificate revocation list

func CreateCRL

func CreateCRL(pkey *ecdsa.PrivateKey, caCert *x509.Certificate, crl *x509.RevocationList, nextUpdate time.Time) (*CertRevocationList, *big.Int, error)

CreateCRL Create certificate revocation list

func RevokeCertificate

func RevokeCertificate(crl []byte, cert *x509.Certificate, caCert *x509.Certificate, pkey *ecdsa.PrivateKey, nextUpdate time.Time) (*CertRevocationList, *big.Int, error)

func (*CertRevocationList) String

func (c *CertRevocationList) String() string

String return string of certificate revocation list in pem encoded format

type Certificate

type Certificate struct {
	SerialNumber     *big.Int
	Subject          pkix.Name
	NotBefore        time.Time
	NotAfter         time.Time
	IPAddress        []net.IP
	DNSNames         []string
	IsCA             bool
	Parent           *x509.Certificate
	ParentPrivateKey interface{}
	KeyUsage         x509.KeyUsage
	ExtentedKeyUsage []x509.ExtKeyUsage
	SubjectKeyId     []byte
	AuthorityKeyId   []byte
}

Certificate hold certificate information

func (*Certificate) GetCertificate

func (c *Certificate) GetCertificate(pkey *ecdsa.PrivateKey) (*Result, error)

GetCertificate generate certificate and returns it in Result struct

func (*Certificate) SetTemplate

func (c *Certificate) SetTemplate() x509.Certificate

SetTemplate set template for x509.Certificate from given Certificate struct

type PrivateKey

type PrivateKey struct {
	*ecdsa.PrivateKey
}

PrivateKey hold private key

func GetPrivateKey

func GetPrivateKey() (*PrivateKey, error)

GetPrivateKey returns struct PrivateKey containing the private key

func (*PrivateKey) String

func (p *PrivateKey) String() string

String returns string of private key in pem encoded format

type Result

type Result struct {
	ByteCert []byte
	Cert     *x509.Certificate
}

Result hold created certificate in []byte format

func (*Result) String

func (r *Result) String() string

String returns certificate in string format

Jump to

Keyboard shortcuts

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