ca

package
v0.0.0-...-9c7e750 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetPubkeyFromCert

func GetPubkeyFromCert(cert Cert) (crypto.PubKey, error)

GetPubkeyFromCert gets the pubkey from certificate

func UnexpectedPubKeyAlgo

func UnexpectedPubKeyAlgo(expected string, pubkey interface{}) error

func VerifyCertFromRoot

func VerifyCertFromRoot(cert, rootCert Cert) error

Types

type Cert

type Cert interface {
	WritePrivateKeytoMem() ([]byte, error)
	VerifyCertFromRoot(rootCert Cert) error
}

func ReadCertificateFromMem

func ReadCertificateFromMem(data []byte) (Cert, error)

func ReadSM2CertFromMem

func ReadSM2CertFromMem(data []byte) (Cert, error)

func ReadX509CertFromMem

func ReadX509CertFromMem(data []byte) (Cert, error)

type Sm2Cert

type Sm2Cert struct {
	*x509.Certificate
	*sm2.PrivateKey
}

Sm2Cert defines sm2 signed X509 certificate

func (Sm2Cert) VerifyCertFromRoot

func (sm2c Sm2Cert) VerifyCertFromRoot(rootCert Cert) error

func (Sm2Cert) WritePrivateKeytoMem

func (sm2c Sm2Cert) WritePrivateKeytoMem() ([]byte, error)

type X509Cert

type X509Cert struct {
	*x509.Certificate
	PrivateKey interface{}
}

X509Cert defines custom X509 certificate

func (X509Cert) VerifyCertFromRoot

func (xc X509Cert) VerifyCertFromRoot(rootCert Cert) error

func (X509Cert) WritePrivateKeytoMem

func (xc X509Cert) WritePrivateKeytoMem() ([]byte, error)

Jump to

Keyboard shortcuts

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