fabric: github.com/hyperledger/fabric/common/crypto Index | Files | Directories

package crypto

import "github.com/hyperledger/fabric/common/crypto"

Index

Package Files

expiration.go random.go

Constants

const (
    // NonceSize is the default NonceSize
    NonceSize = 24
)

Variables

var (
    // ErrPubKeyMismatch is used by CertificatesWithSamePublicKey to indicate the two public keys mismatch
    ErrPubKeyMismatch = errors.New("public keys do not match")
)

func CertificatesWithSamePublicKey Uses

func CertificatesWithSamePublicKey(der1, der2 []byte) error

CertificatesWithSamePublicKey returns nil if both byte slices are valid DER encoding of certificates with the same public key.

func ExpiresAt Uses

func ExpiresAt(identityBytes []byte) time.Time

ExpiresAt returns when the given identity expires, or a zero time.Time in case we cannot determine that

func GetRandomBytes Uses

func GetRandomBytes(len int) ([]byte, error)

GetRandomBytes returns len random looking bytes

func GetRandomNonce Uses

func GetRandomNonce() ([]byte, error)

GetRandomNonce returns a random byte array of length NonceSize

func LogNonPubKeyMismatchErr Uses

func LogNonPubKeyMismatchErr(log func(template string, args ...interface{}), err error, cert1DER, cert2DER []byte)

LogNonPubKeyMismatchErr logs an error which is not an ErrPubKeyMismatch error

func TrackExpiration Uses

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

TrackExpiration warns a week before one of the certificates expires

type MessageFunc Uses

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

MessageFunc notifies a message happened with the given format, and can be replaced with Warnf or Infof of a logger.

type Scheduler Uses

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

Scheduler invokes f after d time, and can be replaced with time.AfterFunc.

Directories

PathSynopsis
tlsgen

Package crypto imports 8 packages (graph) and is imported by 142 packages. Updated 2020-08-27. Refresh now. Tools for package owners.