core

package
v1.68.0 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2023 License: BSD-3-Clause Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAuthorityKeyIdentifierFromCrl

func GetAuthorityKeyIdentifierFromCrl(crl *pkix.CertificateList) ([]byte, error)

GetAuthorityKeyIdentifierFromCrl Crl

func IsECDSASignedCert

func IsECDSASignedCert(cert *x509.Certificate) bool

IsECDSASignedCert 是否ecdsa证书

func ParseECDSAPubKey2SM2PubKey

func ParseECDSAPubKey2SM2PubKey(key *ecdsa.PublicKey) *sm2.PublicKey

ParseECDSAPubKey2SM2PubKey 将ECDSA的公钥转成SM2公钥

Types

type AuthConfig

type AuthConfig struct {
	RootCerts         [][]byte
	IntermediateCerts [][]byte
	RevocationList    [][]byte
}

AuthConfig 校验器配置

func GetAuthConfig

func GetAuthConfig(dir string) (*AuthConfig, error)

GetAuthConfig 获取证书文件配置

type Certificate

type Certificate struct {
	Raw                asn1.RawContent
	TBSCertificate     TbsCertificate
	SignatureAlgorithm pkix.AlgorithmIdentifier
	SignatureValue     asn1.BitString
}

Certificate Certificate

func CertFromX509Cert

func CertFromX509Cert(cert *x509.Certificate) (Certificate, error)

CertFromX509Cert x509格式转换

type PublicKeyInfo

type PublicKeyInfo struct {
	Raw       asn1.RawContent
	Algorithm pkix.AlgorithmIdentifier
	PublicKey asn1.BitString
}

PublicKeyInfo PublicKeyInfo

type TbsCertificate

type TbsCertificate struct {
	Raw                asn1.RawContent
	Version            int `asn1:"optional,explicit,default:0,tag:0"`
	SerialNumber       *big.Int
	SignatureAlgorithm pkix.AlgorithmIdentifier
	Issuer             asn1.RawValue
	Validity           Validity
	Subject            asn1.RawValue
	PublicKey          PublicKeyInfo
	UniqueID           asn1.BitString   `asn1:"optional,tag:1"`
	SubjectUniqueID    asn1.BitString   `asn1:"optional,tag:2"`
	Extensions         []pkix.Extension `asn1:"optional,explicit,tag:3"`
}

TbsCertificate TbsCertificate

type Validator

type Validator interface {
	Setup(config *AuthConfig) error

	Validate(cert []byte, pubKey []byte) error

	GetCertFromSignature(signature []byte) ([]byte, error)
}

Validator 证书校验器

type Validity

type Validity struct {
	NotBefore, NotAfter time.Time
}

Validity Validity

Jump to

Keyboard shortcuts

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