cert

package
v0.0.0-...-958d957 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotPemEncodedKey = errors.New("cert: Key must be PEM encoded PKCS1 or PKCS8 private key")
	ErrNotRSAPrivateKey = errors.New("cert: Key is not a valid RSA private key")
	ErrNotRSAPublicKey  = errors.New("cert: Key is not a valid RSA public key")
	ErrNotRSAPfxData    = errors.New("cert: pfx data not a valid data")
)

Functions

func LoadCertificateFromFile

func LoadCertificateFromFile(path string) (*x509.Certificate, error)

根据文件名解析出证书 openssl pkcs12 -in xxxx.pfx -clcerts -nokeys -out key.cert

func LoadPfxFromFile

func LoadPfxFromFile(name, password string) (*rsa.PrivateKey, *x509.Certificate, error)

func LoadRSAPrivateKeyFromFile

func LoadRSAPrivateKeyFromFile(name string) (*rsa.PrivateKey, error)

func LoadRSAPublicKeyFromFile

func LoadRSAPublicKeyFromFile(name string) (*rsa.PublicKey, error)

func LoadRSAPublicKeyFromPemFile

func LoadRSAPublicKeyFromPemFile(name string) (*rsa.PublicKey, error)

func ParsePfx

func ParsePfx(pfxData []byte, password string) (*rsa.PrivateKey, *x509.Certificate, error)

func ParseRSAPKCS1PrivateKeyFromPEM

func ParseRSAPKCS1PrivateKeyFromPEM(key []byte, password ...string) (*rsa.PrivateKey, error)

ParseRSAPKCS1PrivateKeyFromPEM PEM encoded PKCS1 private key if password exist,PEM encoded PKCS1 private key protected with password, it will decode with password

func ParseRSAPKCS8PrivateKeyFromPEM

func ParseRSAPKCS8PrivateKeyFromPEM(key []byte, password ...string) (*rsa.PrivateKey, error)

ParseRSAPKCS8PrivateKeyFromPEM PEM encoded PKCS8 private key if password exist,PEM encoded PKCS8 private key protected with password, it will decode with password

func ParseRSAPrivateKeyFromPEM

func ParseRSAPrivateKeyFromPEM(key []byte, password ...string) (*rsa.PrivateKey, error)

ParseRSAPrivateKeyFromPEM PEM encoded PKCS1 or PKCS8 private key if password exist,PEM encoded PKCS1 or PKCS8 private key protected with password, it will decode with password

func ParseRSAPublicKey

func ParseRSAPublicKey(key []byte) (*rsa.PublicKey, error)

ParseRSAPublicKey parse public key Pem form PKCS1 or PKCS8 public key PKIX, ASN.1 DER form public key

func ParseRSAPublicKeyFromDer

func ParseRSAPublicKeyFromDer(key []byte) (*rsa.PublicKey, error)

ParseRSAPublicKeyFromDer parse public key PKIX, ASN.1 DER form public key

func ParseRSAPublicKeyFromPEM

func ParseRSAPublicKeyFromPEM(key []byte) (*rsa.PublicKey, error)

ParseRSAPublicKeyFromPEM parse public key Pem form PKCS1 or PKCS8 public key

Types

This section is empty.

Jump to

Keyboard shortcuts

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