Skip to content

Commit 76eedc8

Browse files
author
Jason Yellick
committed
[FAB-2693] (PA) Move identities.proto to proto/msp
This is intended for (PA) post-alpha. https://jira.hyperledger.org/browse/FAB-2693 For some reason, identities.proto is still in fabric/msp rather than in protos/msp/. This CR fixes this bug. Change-Id: I3b337af8f4302866fbeb73d3a7fc5f8f586d5c37 Signed-off-by: Jason Yellick <[email protected]>
1 parent 5b59e06 commit 76eedc8

8 files changed

+40
-49
lines changed

core/peer/peer.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import (
3939
"github.com/hyperledger/fabric/msp"
4040
mspmgmt "github.com/hyperledger/fabric/msp/mgmt"
4141
"github.com/hyperledger/fabric/protos/common"
42+
mspprotos "github.com/hyperledger/fabric/protos/msp"
4243
pb "github.com/hyperledger/fabric/protos/peer"
4344
"github.com/hyperledger/fabric/protos/utils"
4445
"github.com/op/go-logging"
@@ -368,7 +369,7 @@ func buildTrustedRootsForChain(cm configtxapi.Manager) {
368369
for _, root := range v.GetRootCerts() {
369370
sid, err := root.Serialize()
370371
if err == nil {
371-
id := &msp.SerializedIdentity{}
372+
id := &mspprotos.SerializedIdentity{}
372373
err = proto.Unmarshal(sid, id)
373374
if err == nil {
374375
appRootCAs = append(appRootCAs, id.IdBytes)
@@ -378,7 +379,7 @@ func buildTrustedRootsForChain(cm configtxapi.Manager) {
378379
for _, intermediate := range v.GetIntermediateCerts() {
379380
sid, err := intermediate.Serialize()
380381
if err == nil {
381-
id := &msp.SerializedIdentity{}
382+
id := &mspprotos.SerializedIdentity{}
382383
err = proto.Unmarshal(sid, id)
383384
if err == nil {
384385
appRootCAs = append(appRootCAs, id.IdBytes)

msp/identities.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import (
2828
"github.com/hyperledger/fabric/bccsp"
2929
"github.com/hyperledger/fabric/bccsp/signer"
3030
"github.com/hyperledger/fabric/protos/common"
31+
"github.com/hyperledger/fabric/protos/msp"
3132
"github.com/op/go-logging"
3233
)
3334

@@ -86,7 +87,7 @@ func (id *identity) GetOrganizationalUnits() []string {
8687
func NewSerializedIdentity(mspID string, certPEM []byte) ([]byte, error) {
8788
// We serialize identities by prepending the MSPID
8889
// and appending the x509 cert in PEM format
89-
sId := &SerializedIdentity{Mspid: mspID, IdBytes: certPEM}
90+
sId := &msp.SerializedIdentity{Mspid: mspID, IdBytes: certPEM}
9091
raw, err := proto.Marshal(sId)
9192
if err != nil {
9293
return nil, fmt.Errorf("Failed serializing identity [%s][% X]: [%s]", mspID, certPEM, err)
@@ -143,7 +144,7 @@ func (id *identity) Serialize() ([]byte, error) {
143144
}
144145

145146
// We serialize identities by prepending the MSPID and appending the ASN.1 DER content of the cert
146-
sId := &SerializedIdentity{Mspid: id.id.Mspid, IdBytes: pemBytes}
147+
sId := &msp.SerializedIdentity{Mspid: id.id.Mspid, IdBytes: pemBytes}
147148
idBytes, err := proto.Marshal(sId)
148149
if err != nil {
149150
return nil, fmt.Errorf("Could not marshal a SerializedIdentity structure for identity %s, err %s", id.id, err)

msp/msp_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ func TestSerializeIdentitiesWithWrongMSP(t *testing.T) {
130130
return
131131
}
132132

133-
sid := &SerializedIdentity{}
133+
sid := &msp.SerializedIdentity{}
134134
err = proto.Unmarshal(serializedID, sid)
135135
assert.NoError(t, err)
136136

@@ -159,7 +159,7 @@ func TestSerializeIdentitiesWithMSPManager(t *testing.T) {
159159
_, err = mspMgr.DeserializeIdentity(serializedID)
160160
assert.NoError(t, err)
161161

162-
sid := &SerializedIdentity{}
162+
sid := &msp.SerializedIdentity{}
163163
err = proto.Unmarshal(serializedID, sid)
164164
assert.NoError(t, err)
165165

msp/mspimpl.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ func (msp *bccspmsp) DeserializeIdentity(serializedID []byte) (Identity, error)
481481
mspLogger.Infof("Obtaining identity")
482482

483483
// We first deserialize to a SerializedIdentity to get the MSP ID
484-
sId := &SerializedIdentity{}
484+
sId := &m.SerializedIdentity{}
485485
err := proto.Unmarshal(serializedID, sId)
486486
if err != nil {
487487
return nil, fmt.Errorf("Could not deserialize a SerializedIdentity, err %s", err)

msp/mspmgrimpl.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ package msp
1919
import (
2020
"fmt"
2121

22+
"github.com/hyperledger/fabric/protos/msp"
23+
2224
"github.com/golang/protobuf/proto"
2325
"github.com/op/go-logging"
2426
)
@@ -84,7 +86,7 @@ func (mgr *mspManagerImpl) GetMSPs() (map[string]MSP, error) {
8486
// DeserializeIdentity returns an identity given its serialized version supplied as argument
8587
func (mgr *mspManagerImpl) DeserializeIdentity(serializedID []byte) (Identity, error) {
8688
// We first deserialize to a SerializedIdentity to get the MSP ID
87-
sId := &SerializedIdentity{}
89+
sId := &msp.SerializedIdentity{}
8890
err := proto.Unmarshal(serializedID, sId)
8991
if err != nil {
9092
return nil, fmt.Errorf("Could not deserialize a SerializedIdentity, err %s", err)

msp/identities.pb.go protos/msp/identities.pb.go

+20-14
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

msp/identities.proto protos/msp/identities.proto

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ limitations under the License.
1616

1717
syntax = "proto3";
1818

19-
option go_package = "github.com/hyperledger/fabric/msp";
19+
option go_package = "github.com/hyperledger/fabric/protos/msp";
2020

2121
package msp;
2222

protos/msp/mspconfig.pb.go

+7-26
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)