Documentation ¶
Index ¶
- Constants
- Variables
- func CertificatesWithSamePublicKey(der1, der2 []byte) error
- func ExpiresAt(identityBytes []byte) time.Time
- func GetRandomBytes(len int) ([]byte, error)
- func GetRandomNonce() ([]byte, error)
- func LogNonPubKeyMismatchErr(log func(template string, args ...interface{}), err error, ...)
- func TrackExpiration(tls bool, serverCert []byte, clientCertChain [][]byte, sIDBytes []byte, ...)
- type IdentitySerializer
- type LocalSigner
- type MessageFunc
- type Scheduler
- type SignatureHeaderCreator
- type SignatureHeaderMaker
- type Signer
- type SignerSupport
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") )
Functions ¶
func CertificatesWithSamePublicKey ¶ added in v1.4.11
CertificatesWithSamePublicKey returns nil if both byte slices are valid DER encoding of certificates with the same public key.
func ExpiresAt ¶ added in v1.1.1
ExpiresAt returns when the given identity expires, or a zero time.Time in case we cannot determine that
func GetRandomBytes ¶
GetRandomBytes returns len random looking bytes
func GetRandomNonce ¶
GetRandomNonce returns a random byte array of length NonceSize
func LogNonPubKeyMismatchErr ¶ added in v1.4.11
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 ¶ added in v1.4.5
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
Types ¶
type IdentitySerializer ¶ added in v1.3.0
type IdentitySerializer interface { // Serialize converts an identity to bytes Serialize() ([]byte, error) }
IdentitySerializer serializes identities
type LocalSigner ¶
type LocalSigner interface { SignatureHeaderMaker Signer }
LocalSigner is a temporary stub interface which will be implemented by the local MSP
type MessageFunc ¶ added in v1.4.11
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 ¶ added in v1.4.5
Scheduler invokes f after d time, and can be replaced with time.AfterFunc.
type SignatureHeaderCreator ¶ added in v1.3.0
type SignatureHeaderCreator struct {
SignerSupport
}
SignatureHeaderCreator creates signature headers
func NewSignatureHeaderCreator ¶ added in v1.3.0
func NewSignatureHeaderCreator(ss SignerSupport) *SignatureHeaderCreator
NewSignatureHeaderCreator creates new signature headers
func (*SignatureHeaderCreator) NewSignatureHeader ¶ added in v1.3.0
func (bs *SignatureHeaderCreator) NewSignatureHeader() (*cb.SignatureHeader, error)
NewSignatureHeader creates a SignatureHeader with the correct signing identity and a valid nonce
type SignatureHeaderMaker ¶ added in v1.3.0
type SignatureHeaderMaker interface { // NewSignatureHeader creates a SignatureHeader with the correct signing identity and a valid nonce NewSignatureHeader() (*cb.SignatureHeader, error) }
SignatureHeaderMaker creates a new SignatureHeader
type Signer ¶ added in v1.3.0
type Signer interface { // Sign a message and return the signature over the digest, or error on failure Sign(message []byte) ([]byte, error) }
Signer signs messages
type SignerSupport ¶ added in v1.3.0
type SignerSupport interface { Signer IdentitySerializer }
SignerSupport implements the needed support for LocalSigner