cert

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2020 License: GPL-3.0 Imports: 23 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckSignature

func CheckSignature(cert *x509.Certificate) error

func CheckSignatureFrom

func CheckSignatureFrom(son *x509.Certificate, parent *x509.Certificate) error

func CheckSignatureFromSM2

func CheckSignatureFromSM2(son, parent *x509.Certificate) error

func CheckSignatureSM2

func CheckSignatureSM2(csr *x509.Certificate) error

func CreateCertBySMPrivte

func CreateCertBySMPrivte(pri *sm2.PrivateKey, pub *sm2.PublicKey) (cert []byte)

func CreateCertificate

func CreateCertificate(cinfo *TBSCertificate, signature []byte) ([]byte, error)

func CreateCertificateRequest

func CreateCertificateRequest(template *x509.CertificateRequest, pub *sm2.PublicKey,
	pri *sm2.PrivateKey, userId []byte) (csr []byte, err error)

func CreateRootCert

func CreateRootCert(rootPri *sm2.PrivateKey) (cert []byte, err error)

func FillCertificateTemplateByCSR

func FillCertificateTemplateByCSR(template *x509.Certificate, csr *x509.CertificateRequest)

func FromCertBytesToPubKey

func FromCertBytesToPubKey(asn1Data []byte) (*ecdsa.PublicKey, error)

func FromCertBytesToPubKey1

func FromCertBytesToPubKey1(asn1Data []byte) (*ecdsa.PublicKey, error)

func GetCertFromByte

func GetCertFromByte(idBytes []byte) (*x509.Certificate, error)

func GetPubByteFromCert

func GetPubByteFromCert(asn1Data []byte) ([]byte, error)

func IsCorrectSY

func IsCorrectSY(syCrypto interface{}) bool

func IsEqulCert

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

func IssueCert

func IssueCert(rootcert *x509.Certificate, rootPri *sm2.PrivateKey, sonPuk *sm2.PublicKey) (cert []byte, err error)

func IssueCertificateBySoftCAKey

func IssueCertificateBySoftCAKey(cinfo *TBSCertificate, caPri *sm2.PrivateKey, userId []byte) ([]byte, error)

func ParseCertificate

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

func ParseCertificateRequest

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

ParseCertificateRequest parses a single certificate request from the given ASN.1 DER data.

func ParseCertificateSM2

func ParseCertificateSM2(asn1Data []byte) (*x509.Certificate, error)

ParseCertificate parses a single certificate from the given ASN.1 DER data.

func ReadPemFileByPath

func ReadPemFileByPath(path string) ([]byte, error)

func VarifyCertByPubKey

func VarifyCertByPubKey(pubkey *sm2.PublicKey, cert []byte) error

func VerifyCSRSign

func VerifyCSRSign(csr *x509.CertificateRequest, userId []byte) bool

func VerifyDERCSRSign

func VerifyDERCSRSign(asn1Data []byte, userId []byte) (bool, error)

Types

type TBSCertificate

type TBSCertificate tbsCertificate

func CreateCertificateInfo

func CreateCertificateInfo(template, parent *x509.Certificate, csr *x509.CertificateRequest) (*TBSCertificate, error)

为什么要将构建CertificateInfo和签发证书分开呢? 是因为实际应用中的CA密钥大多数都是放在加密卡/加密机中的,签名由加密卡/加密机来完成

Directories

Path Synopsis
crypto
sm2
sm3

Jump to

Keyboard shortcuts

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