hyperledger/fabric · error

ASN encoding failed

Error message

ASN encoding failed

What it means

VerifyAuthRequest wraps a failure of asn1.Marshal on the AuthRequestSignature structure (version, timestamp, IDs, TLS session binding, channel). Marshal fails when a field cannot be encoded in ASN.1 — e.g. a string containing characters invalid for its ASN.1 tag — indicating a malformed or hostile remote request.

Source

Thrown at orderer/common/cluster/clusterservice.go:148

	tlsBinding, err := GetTLSSessionBinding(stream.Context(), bindingFieldsHash)
	if err != nil {
		return nil, errors.Wrap(err, "session binding read failed")
	}

	if !bytes.Equal(tlsBinding, authReq.SessionBinding) {
		return nil, errors.New("session binding mismatch")
	}

	msg, err := asn1.Marshal(AuthRequestSignature{
		Version:        int64(authReq.Version),
		Timestamp:      EncodeTimestamp(authReq.Timestamp),
		FromId:         strconv.FormatUint(authReq.FromId, 10),
		ToId:           strconv.FormatUint(authReq.ToId, 10),
		SessionBinding: tlsBinding,
		Channel:        authReq.Channel,
	})
	if err != nil {
		return nil, errors.Wrap(err, "ASN encoding failed")
	}

	membership := s.MembershipByChannel[authReq.Channel]
	if membership == nil {
		return nil, errors.Errorf("channel %s not found in config", authReq.Channel)
	}

	fromIdentity := membership.MemberMapping[authReq.FromId]
	if fromIdentity == nil {
		return nil, errors.Errorf("node %d is not member of channel %s", authReq.FromId, authReq.Channel)
	}

	toIdentity := membership.MemberMapping[authReq.ToId]
	if toIdentity == nil {
		return nil, errors.Errorf("node %d is not member of channel %s", authReq.ToId, authReq.Channel)
	}

	equal, err := CompareCertPublicKeys(toIdentity, s.NodeIdentity)

View on GitHub (pinned to 2736b63f8f)

Solutions

  1. Drop the request; the remote node is sending malformed authentication requests
  2. Check for version skew between cluster nodes producing incompatible AuthRequest fields
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at orderer/common/cluster/clusterservice.go:148 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of hyperledger/fabric@2736b63f8f (2026-09-04). Data as JSON: /api/errors/c58f423854dd328d. Report an issue: GitHub.