Skip to content

Commit

Permalink
Disable encoding of MSPID in serlz'd identities
Browse files Browse the repository at this point in the history
This is a temporary workaround to ensure interoperability with the SDK until we
find a proper encoding schema that works for both SDK and peer.

Change-Id: I8e54fa78f4edd5e08c6679f48f8dc27adabfe290
Signed-off-by: Alessandro Sorniotti <ale.linux@sopit.net>
  • Loading branch information
ale-linux committed Nov 21, 2016
1 parent 9d3abd1 commit 8aa2f52
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions msp/identities.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ import (
"crypto/x509"
"fmt"

"encoding/asn1"

"github.com/hyperledger/fabric/core/crypto/bccsp"
"github.com/hyperledger/fabric/core/crypto/bccsp/factory"
"github.com/hyperledger/fabric/core/crypto/bccsp/signer"
Expand Down Expand Up @@ -80,6 +78,7 @@ func (id *identity) VerifyAttributes(proof [][]byte, spec *AttributeProofSpec) (
}

func (id *identity) Serialize() ([]byte, error) {
/*
mspLogger.Infof("Serializing identity %s", id.id)
// We serialize identities by prepending the MSPID and appending the ASN.1 DER content of the cert
Expand All @@ -90,6 +89,8 @@ func (id *identity) Serialize() ([]byte, error) {
}
return idBytes, nil
*/
return id.cert.Raw, nil
}

type signingidentity struct {
Expand Down
5 changes: 3 additions & 2 deletions msp/peermspmanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ import (
"fmt"
"sync"

"encoding/asn1"

"github.com/op/go-logging"
)

Expand Down Expand Up @@ -139,6 +137,7 @@ func (mgr *peerMspManagerImpl) GetSigningIdentity(identifier *IdentityIdentifier
}

func (mgr *peerMspManagerImpl) DeserializeIdentity(serializedID []byte) (Identity, error) {
/*
// We first deserialize to a SerializedIdentity to get the MSP ID
sId := &SerializedIdentity{}
_, err := asn1.Unmarshal(serializedID, sId)
Expand All @@ -154,6 +153,8 @@ func (mgr *peerMspManagerImpl) DeserializeIdentity(serializedID []byte) (Identit
// if we have this MSP, we ask it to deserialize
return msp.DeserializeIdentity(sId.IdBytes)
*/
return mgr.mspsMap["DEFAULT"].DeserializeIdentity(serializedID) // FIXME!
}

func (mgr *peerMspManagerImpl) DeleteSigningIdentity(identifier string) (bool, error) {
Expand Down

0 comments on commit 8aa2f52

Please sign in to comment.