crypto

package
v0.0.0-...-e3e94bd Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const NonceSize = 24

Variables

View Source
var ErrPublicKeyMismatch = errors.New("public keys do not match")

Functions

func CertificateWithSamePublicKey

func CertificateWithSamePublicKey(der1, der2 []byte) error

CertificateWithSamePublicKey 给定两个 ASN.1 DER 格式的证书数据,然后判断这两个证书中的公钥是否相同,不相同的话则会返回一个 non-nil 错误。

func ExpiresAt

func ExpiresAt(identityBytes []byte) time.Time

ExpiresAt 给定一个 &msp.SerializedIdentity{} 的序列化数据,返回其中节点身份证书的过期时间。

func GetRandomNonce

func GetRandomNonce() ([]byte, error)

func LoNonPublicKeyMismatchErr

func LoNonPublicKeyMismatchErr(log func(template string, args ...interface{}), err error, certDER1, certDER2 []byte)

LoNonPublicKeyMismatchErr 在日志中记载两个证书中公钥不匹配的错误(非 ErrPublicKeyMismatch 错误)。

func TrackExpiration

func TrackExpiration(tls bool, serverCrt []byte, clientCertChain [][]byte, sIDBytes []byte, info MessageFunc, warn MessageFunc, now time.Time, s Scheduler)

TrackExpiration 传入的第二个参数 serverCert 是 x509 身份证书的 ASN.1 DER PEM 格式的数据。传入的第三个参数 clientCertChain 是一连串的客户端的 x509 身份证书 的 ASN.1 DER PEM 格式的数据。

Types

type MessageFunc

type MessageFunc func(format string, args ...interface{})

type Scheduler

type Scheduler func(d time.Duration, f func()) *time.Timer

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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