ber

package
v1.0.2047 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var LoadPKCS12 = LoadPKCS12FromBytes

Functions

func Decode

func Decode(pfxData []byte, password string) (
	privateKey any,
	certificate *x509.Certificate,
	err error,
)

解析 ber 编码的 PKCS12 证书

func DecodeChain

func DecodeChain(pfxData []byte, password string) (
	privateKey any,
	certificate *x509.Certificate,
	caCerts []*x509.Certificate,
	err error,
)

解析 ber 编码的 PKCS12 证书

func DecodeSecret

func DecodeSecret(pfxData []byte, password string) (secretKey []byte, err error)

解析 ber 编码的 PKCS12 证书

func DecodeTrustStore

func DecodeTrustStore(pfxData []byte, password string) (certs []*x509.Certificate, err error)

解析 ber 编码的 PKCS12 证书

func DecodeTrustStoreEntries

func DecodeTrustStoreEntries(pfxData []byte, password string) (trustStoreKeys []cryptobin_pkcs12.TrustStoreKey, err error)

解析 ber 编码的 PKCS12 证书

func LoadPKCS12FromBytes added in v1.0.2033

func LoadPKCS12FromBytes(pfxData []byte, password string) (*cryptobin_pkcs12.PKCS12, error)

LoadPKCS12FromBytes loads the key store from the bytes data.

func LoadPKCS12FromReader added in v1.0.2033

func LoadPKCS12FromReader(reader io.Reader, password string) (*cryptobin_pkcs12.PKCS12, error)

LoadPKCS12FromReader loads the key store from the specified file.

func Parse

func Parse(ber []byte, password []byte) ([]byte, error)

转换 BER 编码的 PKCS12 证书为 DER 编码

Types

type AlgorithmIdentifier

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

type ContentInfo

type ContentInfo struct {
	ContentType cryptobin_asn1.ObjectIdentifier
	Content     cryptobin_asn1.RawValue `asn1:"tag:0,explicit,optional"`
}

type DigestInfo

type DigestInfo struct {
	Algorithm AlgorithmIdentifier
	Digest    []byte
}

from PKCS#7:

type EncryptedContentInfo

type EncryptedContentInfo struct {
	ContentType                cryptobin_asn1.ObjectIdentifier
	ContentEncryptionAlgorithm AlgorithmIdentifier
	EncryptedContent           cryptobin_asn1.RawValue `asn1:"tag:0,optional"`
}

type EncryptedData

type EncryptedData struct {
	Version              int
	EncryptedContentInfo EncryptedContentInfo
}

type MacData

type MacData struct {
	Mac        DigestInfo
	MacSalt    []byte
	Iterations int `asn1:"optional,default:1"`
}

func (MacData) Verify

func (this MacData) Verify(message []byte, password []byte) error

type PfxPdu

type PfxPdu struct {
	Version  int
	AuthSafe ContentInfo
	MacData  MacData `asn1:"optional"`
}

Jump to

Keyboard shortcuts

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