hyperledger/fabric · error
failed exporting keying material
Error message
failed exporting keying material
What it means
After the peer context is extracted, GetTLSSessionBinding exports RFC 5705 keying material from the connection's TLS state via exportKM. If that export fails (nil or unusable TLS connection state), the underlying error is wrapped with this message.
Source
Thrown at orderer/common/cluster/util.go:707
return util.ComputeSHA256(util.ConcatenateBytes(
[]byte(strconv.FormatUint(uint64(authReq.Version), 10)),
EncodeTimestamp(authReq.Timestamp),
[]byte(strconv.FormatUint(authReq.FromId, 10)),
[]byte(strconv.FormatUint(authReq.ToId, 10)),
[]byte(authReq.Channel),
))
}
func GetTLSSessionBinding(ctx context.Context, bindingPayload []byte) ([]byte, error) {
peerInfo, ok := peer.FromContext(ctx)
if !ok {
return nil, errors.New("failed extracting stream context")
}
connState := peerInfo.AuthInfo.(credentials.TLSInfo).State
tlsBinding, err := exportKM(connState, KeyingMaterialLabel, bindingPayload)
if err != nil {
return nil, errors.Wrap(err, "failed exporting keying material")
}
return tlsBinding, nil
}
func VerifySignature(identity, msgHash, signature []byte) error {
block, _ := pem.Decode(identity)
if block == nil {
return errors.New("pem decoding failed")
}
cert, err := x509.ParseCertificate(block.Bytes)
if err != nil {
return errors.Wrap(err, "key extraction failed")
}
pubKey, isECDSA := cert.PublicKey.(*ecdsa.PublicKey)
if !isECDSA {View on GitHub (pinned to 2736b63f8f)
Solutions
- Ensure TLS 1.2+ end-to-end between client and orderer (no TLS termination at a proxy)
- Verify both peers negotiate a TLS version/cipher suite supporting keying-material export
- Check that the connection state passed to exportKM comes from the live connection (peerInfo.AuthInfo), not a cached stale one
- Inspect the wrapped inner error in the log to identify the exact exporter failure
Example fix
// before conn, _ := grpc.Dial(addr, grpc.WithInsecure()) // no TLS -> binding will fail downstream // after conn, _ := grpc.Dial(addr, grpc.WithTransportCredentials(credentials.NewTLS(tlsConfig)))
Defensive patterns
Strategy: try-catch
Validate before calling
if pi, ok := peer.FromContext(ctx); ok {
tlsInfo, ok := pi.AuthInfo.(credentials.TLSInfo)
if !ok || tlsInfo.State.Version == 0 {
return errors.New("no usable TLS connection state in peer auth info")
}
} Type guard
func hasExportableTLS(ctx context.Context) bool {
pi, ok := peer.FromContext(ctx)
if !ok { return false }
tlsInfo, ok := pi.AuthInfo.(credentials.TLSInfo)
return ok && tlsInfo.State.ESA != nil || ok && tlsInfo.State.Version != 0
} Try / catch
binding, err := cluster.GetTLSSessionBinding(ctx, payload)
if err != nil {
var inner string = err.Error()
if strings.Contains(inner, "failed exporting keying material") {
logger.Warningf("TLS exporter unavailable: %v (check TLS version/termination)", err)
}
return err
} Prevention
- Use TLS 1.2+ with exporter-capable cipher suites end to end
- Avoid TLS-terminating proxies in front of orderers
- Log wrapped cause errors (%+v) to surface the exporter failure
- Pin TLS config in both client and server dial options
When it happens
Trigger: The peer's AuthInfo contains a credentials.TLSInfo whose ConnectionState cannot be used for exporter calls — e.g. the TLS handshake was resumed/renegotiated differently, exporter is not available, or the connection state is zero-valued in a non-standard transport implementation.
Common situations: Proxy/terminating-TLS deployments where the orderer's gRPC connection is not the TLS session the client thinks it is; unusual TLS stacks or test fakes supplying incomplete credentials.TLSInfo; TLS version mismatches (TLS 1.0/1.1 without exporter support).
Related errors
- client didn't include its TLS cert hash
- client didn't send a TLS certificate
- claimed TLS cert hash is %v but actual TLS cert hash is %v
- failed connecting to discovery service
- failed connecting to %s: %v
AI-assisted analysis of hyperledger/fabric@2736b63f8f (2026-09-04).
Data as JSON: /api/errors/091229dc4f39c4a2.
Report an issue: GitHub.