Documentation ¶
Index ¶
- Variables
- func CertDateValidCheck(cert *x509.Certificate) bool
- func CheckSignatureByCert(algo x509.SignatureAlgorithm, msg []byte, sig []byte, cert *x509.Certificate) error
- func DumpCertificateAsPem(cert *Certificate) ([]byte, error)
- func FmtSerialNumberString(s *big.Int) string
- func GetHashOfAlgo(algo x509.SignatureAlgorithm) x509.Hash
- func GetPublicKeySizeFromCert(cert *Certificate) int
- func GetRawPublicKeyInfoFromCSR(f []byte) ([]byte, error)
- func GetSignatureAlgorithmFromAI(ai pkix.AlgorithmIdentifier) x509.SignatureAlgorithm
- func MakePfx(priv interface{}, certificate *x509.Certificate, pwd string) ([]byte, error)
- func NewCSR(subject, algo string) (privBytes []byte, csrBytes []byte, err error)
- func NewHashFunc(algo x509.SignatureAlgorithm, salt []byte) func([]byte) Hashed
- func ParseSignatureAlgo(s string) (x509.SignatureAlgorithm, error)
- func ReadPrivateKeyFromBytes(f []byte) (crypto.PrivateKey, error)
- func ReadPrivateKeyFromFile(path string) (crypto.PrivateKey, error)
- func SignAndVerify(priv crypto.PrivateKey, cert *x509.Certificate) error
- func SignMsgByPrivateKey(algo x509.SignatureAlgorithm, msg []byte, priv crypto.PrivateKey) (sig []byte, err error)
- type Certificate
- type Hashed
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ParsePKCS7 = x509.ParsePKCS7 ParseCertificate = x509.ParseCertificate ParseCertificates = x509.ParseCertificates )
View Source
var ( OIDSignatureSHA256WithRSA = asn1.ObjectIdentifier{1, 2, 840, 113549, 1, 1, 11} OIDSignatureECDSAWithSHA256 = asn1.ObjectIdentifier{1, 2, 840, 10045, 4, 3, 2} OIDSignatureSM2WithSM3 = asn1.ObjectIdentifier{1, 2, 156, 10197, 1, 501} )
Functions ¶
func CertDateValidCheck ¶
func CertDateValidCheck(cert *x509.Certificate) bool
func CheckSignatureByCert ¶
func CheckSignatureByCert( algo x509.SignatureAlgorithm, msg []byte, sig []byte, cert *x509.Certificate, ) error
func DumpCertificateAsPem ¶
func DumpCertificateAsPem(cert *Certificate) ([]byte, error)
func FmtSerialNumberString ¶
func GetHashOfAlgo ¶
func GetHashOfAlgo(algo x509.SignatureAlgorithm) x509.Hash
func GetPublicKeySizeFromCert ¶
func GetPublicKeySizeFromCert(cert *Certificate) int
func GetSignatureAlgorithmFromAI ¶
func GetSignatureAlgorithmFromAI(ai pkix.AlgorithmIdentifier) x509.SignatureAlgorithm
func MakePfx ¶
func MakePfx(priv interface{}, certificate *x509.Certificate, pwd string) ([]byte, error)
MakePfx .
func NewHashFunc ¶
func NewHashFunc(algo x509.SignatureAlgorithm, salt []byte) func([]byte) Hashed
func ParseSignatureAlgo ¶
func ParseSignatureAlgo(s string) (x509.SignatureAlgorithm, error)
func ReadPrivateKeyFromBytes ¶
func ReadPrivateKeyFromBytes(f []byte) (crypto.PrivateKey, error)
ReadPrivateKeyFromBytes .
func ReadPrivateKeyFromFile ¶
func ReadPrivateKeyFromFile(path string) (crypto.PrivateKey, error)
ReadPrivateKeyFromFile .
func SignAndVerify ¶
func SignAndVerify(priv crypto.PrivateKey, cert *x509.Certificate) error
SignAndVerify check if priv and cert's pub match
func SignMsgByPrivateKey ¶
func SignMsgByPrivateKey( algo x509.SignatureAlgorithm, msg []byte, priv crypto.PrivateKey, ) (sig []byte, err error)
Types ¶
type Certificate ¶
type Certificate = x509.Certificate
func ReadCertificateFromBytes ¶
func ReadCertificateFromBytes(f []byte) (*Certificate, error)
func ReadCertificateFromFile ¶
func ReadCertificateFromFile(path string) (*Certificate, error)
ReadCertificateFromFile reads cert from file only one
Click to show internal directories.
Click to hide internal directories.