utils

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PEMtoPrivateKey

func PEMtoPrivateKey(raw []byte, pwd []byte) (*sm2.PrivateKey, error)

PEMtoPrivateKey unmarshal a pem to private key

func PEMtoPublicKey

func PEMtoPublicKey(raw []byte, pwd []byte) (*sm2.PublicKey, error)

PEMtoPublicKey unmarshal a pem to public key

func PrivateKeyToEncryptedPEM

func PrivateKeyToEncryptedPEM(priKey *sm2.PrivateKey, pwd []byte) ([]byte, error)

PrivateKeyToEncryptedPEM converts a private key to an encrypted PEM

func PrivateKeyToPEM

func PrivateKeyToPEM(privateKey *sm2.PrivateKey, 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 PublicKeyToEncryptedPEM

func PublicKeyToEncryptedPEM(publicKey *sm2.PublicKey, pwd []byte) ([]byte, error)

PublicKeyToEncryptedPEM converts a public key to encrypted pem

func PublicKeyToPEM

func PublicKeyToPEM(publicKey *sm2.PublicKey, pwd []byte) ([]byte, error)

PublicKeyToPEM marshals a public key to the pem format

Types

type AlgorithmIdentifier

type AlgorithmIdentifier struct {
	Algorithm  asn1.ObjectIdentifier
	Parameters asn1.RawValue `asn1:"optional"`
}

Jump to

Keyboard shortcuts

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