gmsm

package
v0.0.0-...-6a4893c Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Overview

crypto/x509 add sm2 support

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MarshalSm2EcryptedPrivateKey

func MarshalSm2EcryptedPrivateKey(PrivKey *sm2.PrivateKey, pwd []byte) ([]byte, error)

func MarshalSm2PrivateKey

func MarshalSm2PrivateKey(key *sm2.PrivateKey, pwd []byte) ([]byte, error)

func MarshalSm2PublicKey

func MarshalSm2PublicKey(key *sm2.PublicKey) ([]byte, error)

func MarshalSm2UnecryptedPrivateKey

func MarshalSm2UnecryptedPrivateKey(key *sm2.PrivateKey) ([]byte, error)

func ParsePKCS8EcryptedPrivateKey

func ParsePKCS8EcryptedPrivateKey(der, pwd []byte) (*sm2.PrivateKey, error)

func ParsePKCS8PrivateKey

func ParsePKCS8PrivateKey(der, pwd []byte) (*sm2.PrivateKey, error)

func ParsePKCS8UnecryptedPrivateKey

func ParsePKCS8UnecryptedPrivateKey(der []byte) (*sm2.PrivateKey, error)

func ParseSm2PrivateKey

func ParseSm2PrivateKey(der []byte) (*sm2.PrivateKey, error)

func ParseSm2PublicKey

func ParseSm2PublicKey(der []byte) (*sm2.PublicKey, error)

func ReadPrivateKeyFromMem

func ReadPrivateKeyFromMem(data []byte, pwd []byte) (*sm2.PrivateKey, error)

func ReadPrivateKeyFromPem

func ReadPrivateKeyFromPem(FileName string, pwd []byte) (*sm2.PrivateKey, error)

func ReadPublicKeyFromMem

func ReadPublicKeyFromMem(data []byte, _ []byte) (*sm2.PublicKey, error)

func ReadPublicKeyFromPem

func ReadPublicKeyFromPem(FileName string, pwd []byte) (*sm2.PublicKey, error)

func WritePrivateKeytoMem

func WritePrivateKeytoMem(key *sm2.PrivateKey, pwd []byte) ([]byte, error)

func WritePrivateKeytoPem

func WritePrivateKeytoPem(FileName string, key *sm2.PrivateKey, pwd []byte) (bool, error)

func WritePublicKeytoMem

func WritePublicKeytoMem(key *sm2.PublicKey, _ []byte) ([]byte, error)

func WritePublicKeytoPem

func WritePublicKeytoPem(FileName string, key *sm2.PublicKey, _ []byte) (bool, error)

Types

type EncryptedPrivateKeyInfo

type EncryptedPrivateKeyInfo struct {
	EncryptionAlgorithm Pbes2Algorithms
	EncryptedData       []byte
}

reference to https://www.rfc-editor.org/rfc/rfc5958.txt

type Pbes2Algorithms

type Pbes2Algorithms struct {
	IdPBES2     asn1.ObjectIdentifier
	Pbes2Params Pbes2Params
}

reference to https://www.ietf.org/rfc/rfc2898.txt

type Pbes2Encs

type Pbes2Encs struct {
	EncryAlgo asn1.ObjectIdentifier
	IV        []byte
}

type Pbes2KDfs

type Pbes2KDfs struct {
	IdPBKDF2    asn1.ObjectIdentifier
	Pkdf2Params Pkdf2Params
}

reference to https://www.ietf.org/rfc/rfc2898.txt

type Pbes2Params

type Pbes2Params struct {
	KeyDerivationFunc Pbes2KDfs // PBES2-KDFs
	EncryptionScheme  Pbes2Encs // PBES2-Encs
}

reference to https://www.ietf.org/rfc/rfc2898.txt

type Pkdf2Params

type Pkdf2Params struct {
	Salt           []byte
	IterationCount int
	Prf            pkix.AlgorithmIdentifier
}

reference to https://www.ietf.org/rfc/rfc2898.txt

type PrivateKeyInfo

type PrivateKeyInfo struct {
	Version             int // v1 or v2
	PrivateKeyAlgorithm []asn1.ObjectIdentifier
	PrivateKey          []byte
}

reference to https://www.rfc-editor.org/rfc/rfc5958.txt

Jump to

Keyboard shortcuts

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