certutil

package
v0.0.0-...-197daa8 Latest Latest
Warning

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

Go to latest
Published: May 8, 2023 License: MIT Imports: 21 Imported by: 1

Documentation

Index

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 FmtSerialNumberString(s *big.Int) string

func GetHashOfAlgo

func GetHashOfAlgo(algo x509.SignatureAlgorithm) x509.Hash

func GetPublicKeySizeFromCert

func GetPublicKeySizeFromCert(cert *Certificate) int

func GetRawPublicKeyInfoFromCSR

func GetRawPublicKeyInfoFromCSR(f []byte) ([]byte, error)

func MakePfx

func MakePfx(priv interface{}, certificate *x509.Certificate, pwd string) ([]byte, error)

MakePfx .

func NewCSR

func NewCSR(subject, algo string) (privBytes []byte, csrBytes []byte, err error)

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

type Hashed

type Hashed []byte

func (Hashed) Hex

func (h Hashed) Hex() string

Directories

Path Synopsis
this file impls the ra <-> ca rfc4211 ?
this file impls the ra <-> ca rfc4211 ?
forkd from go pkix.go
forkd from go pkix.go

Jump to

Keyboard shortcuts

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