sx509

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UnknownPublicKeyAlgorithm x509.PublicKeyAlgorithm = iota
	RSA
	DSA
	ECDSA
)
View Source
const (
	UnknownSignatureAlgorithm x509.SignatureAlgorithm = iota
	SM2WithSM3
)

Variables

This section is empty.

Functions

func DERToPrivateKey

func DERToPrivateKey(der []byte) (key interface{}, err error)

func DERToPublicKey

func DERToPublicKey(raw []byte) (pub interface{}, err error)

DerToPublicKey unmarshals a der to public key

func MarshalECPrivateKey

func MarshalECPrivateKey(privateKey *ecdsa.PrivateKey) ([]byte, error)

func MarshalPKIXPublicKey

func MarshalPKIXPublicKey(pub interface{}) ([]byte, error)

func PEMtoPrivateKey

func PEMtoPrivateKey(raw []byte, pwd []byte) (interface{}, error)

PEMtoPrivateKey unmarshals a pem to private key

func ParseCertificate

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

func ParseECPrivateKey

func ParseECPrivateKey(der []byte) (key interface{}, err error)

func ParsePKCS8PrivateKey

func ParsePKCS8PrivateKey(der []byte) (key *ecdsa.PrivateKey, err error)

func ParsePKIXPublicKey

func ParsePKIXPublicKey(derBytes []byte) (pub interface{}, err error)

func PemToPublicKey

func PemToPublicKey(raw []byte, pwd []byte) (interface{}, error)

pemToPublicKey unmarshals a pem to public key

func PrivateKeyToPEM

func PrivateKeyToPEM(privateKey interface{}, pwd []byte) ([]byte, error)

privateKeyToPEM converts the private key to PEM format. EC private keys are converted to PKCS#8 format. RSA private keys are converted to PKCS#1 format.

func PublicKeyToPEM

func PublicKeyToPEM(publicKey interface{}, pwd []byte) ([]byte, error)

publicKeyToPEM marshals a public key to the pem format

Types

This section is empty.

Jump to

Keyboard shortcuts

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