diff --git a/core/peer/peer.go b/core/peer/peer.go index 998c6f50599..e19a71e64d2 100644 --- a/core/peer/peer.go +++ b/core/peer/peer.go @@ -39,6 +39,7 @@ import ( "github.com/hyperledger/fabric/msp" mspmgmt "github.com/hyperledger/fabric/msp/mgmt" "github.com/hyperledger/fabric/protos/common" + mspprotos "github.com/hyperledger/fabric/protos/msp" pb "github.com/hyperledger/fabric/protos/peer" "github.com/hyperledger/fabric/protos/utils" "github.com/op/go-logging" @@ -368,7 +369,7 @@ func buildTrustedRootsForChain(cm configtxapi.Manager) { for _, root := range v.GetRootCerts() { sid, err := root.Serialize() if err == nil { - id := &msp.SerializedIdentity{} + id := &mspprotos.SerializedIdentity{} err = proto.Unmarshal(sid, id) if err == nil { appRootCAs = append(appRootCAs, id.IdBytes) @@ -378,7 +379,7 @@ func buildTrustedRootsForChain(cm configtxapi.Manager) { for _, intermediate := range v.GetIntermediateCerts() { sid, err := intermediate.Serialize() if err == nil { - id := &msp.SerializedIdentity{} + id := &mspprotos.SerializedIdentity{} err = proto.Unmarshal(sid, id) if err == nil { appRootCAs = append(appRootCAs, id.IdBytes) diff --git a/msp/identities.go b/msp/identities.go index ba2d84bf3c3..1619e38e09f 100644 --- a/msp/identities.go +++ b/msp/identities.go @@ -28,6 +28,7 @@ import ( "github.com/hyperledger/fabric/bccsp" "github.com/hyperledger/fabric/bccsp/signer" "github.com/hyperledger/fabric/protos/common" + "github.com/hyperledger/fabric/protos/msp" "github.com/op/go-logging" ) @@ -86,7 +87,7 @@ func (id *identity) GetOrganizationalUnits() []string { func NewSerializedIdentity(mspID string, certPEM []byte) ([]byte, error) { // We serialize identities by prepending the MSPID // and appending the x509 cert in PEM format - sId := &SerializedIdentity{Mspid: mspID, IdBytes: certPEM} + sId := &msp.SerializedIdentity{Mspid: mspID, IdBytes: certPEM} raw, err := proto.Marshal(sId) if err != nil { return nil, fmt.Errorf("Failed serializing identity [%s][% X]: [%s]", mspID, certPEM, err) @@ -143,7 +144,7 @@ func (id *identity) Serialize() ([]byte, error) { } // We serialize identities by prepending the MSPID and appending the ASN.1 DER content of the cert - sId := &SerializedIdentity{Mspid: id.id.Mspid, IdBytes: pemBytes} + sId := &msp.SerializedIdentity{Mspid: id.id.Mspid, IdBytes: pemBytes} idBytes, err := proto.Marshal(sId) if err != nil { return nil, fmt.Errorf("Could not marshal a SerializedIdentity structure for identity %s, err %s", id.id, err) diff --git a/msp/msp_test.go b/msp/msp_test.go index 17bc40122dd..09b461f4a94 100644 --- a/msp/msp_test.go +++ b/msp/msp_test.go @@ -130,7 +130,7 @@ func TestSerializeIdentitiesWithWrongMSP(t *testing.T) { return } - sid := &SerializedIdentity{} + sid := &msp.SerializedIdentity{} err = proto.Unmarshal(serializedID, sid) assert.NoError(t, err) @@ -159,7 +159,7 @@ func TestSerializeIdentitiesWithMSPManager(t *testing.T) { _, err = mspMgr.DeserializeIdentity(serializedID) assert.NoError(t, err) - sid := &SerializedIdentity{} + sid := &msp.SerializedIdentity{} err = proto.Unmarshal(serializedID, sid) assert.NoError(t, err) diff --git a/msp/mspimpl.go b/msp/mspimpl.go index 9081f313a7b..023ae7e6782 100644 --- a/msp/mspimpl.go +++ b/msp/mspimpl.go @@ -481,7 +481,7 @@ func (msp *bccspmsp) DeserializeIdentity(serializedID []byte) (Identity, error) mspLogger.Infof("Obtaining identity") // We first deserialize to a SerializedIdentity to get the MSP ID - sId := &SerializedIdentity{} + sId := &m.SerializedIdentity{} err := proto.Unmarshal(serializedID, sId) if err != nil { return nil, fmt.Errorf("Could not deserialize a SerializedIdentity, err %s", err) diff --git a/msp/mspmgrimpl.go b/msp/mspmgrimpl.go index 87f35956760..e34fa56d486 100644 --- a/msp/mspmgrimpl.go +++ b/msp/mspmgrimpl.go @@ -19,6 +19,8 @@ package msp import ( "fmt" + "github.com/hyperledger/fabric/protos/msp" + "github.com/golang/protobuf/proto" "github.com/op/go-logging" ) @@ -84,7 +86,7 @@ func (mgr *mspManagerImpl) GetMSPs() (map[string]MSP, error) { // DeserializeIdentity returns an identity given its serialized version supplied as argument func (mgr *mspManagerImpl) DeserializeIdentity(serializedID []byte) (Identity, error) { // We first deserialize to a SerializedIdentity to get the MSP ID - sId := &SerializedIdentity{} + sId := &msp.SerializedIdentity{} err := proto.Unmarshal(serializedID, sId) if err != nil { return nil, fmt.Errorf("Could not deserialize a SerializedIdentity, err %s", err) diff --git a/msp/identities.pb.go b/protos/msp/identities.pb.go similarity index 60% rename from msp/identities.pb.go rename to protos/msp/identities.pb.go index d831b0b997f..48971e5b58e 100644 --- a/msp/identities.pb.go +++ b/protos/msp/identities.pb.go @@ -1,15 +1,21 @@ // Code generated by protoc-gen-go. -// source: identities.proto +// source: msp/identities.proto // DO NOT EDIT! /* Package msp is a generated protocol buffer package. It is generated from these files: - identities.proto + msp/identities.proto + msp/mspconfig.proto It has these top-level messages: SerializedIdentity + MSPConfig + FabricMSPConfig + SigningIdentityInfo + KeyInfo + FabricOUIdentifier */ package msp @@ -47,18 +53,18 @@ func init() { proto.RegisterType((*SerializedIdentity)(nil), "msp.SerializedIdentity") } -func init() { proto.RegisterFile("identities.proto", fileDescriptor0) } +func init() { proto.RegisterFile("msp/identities.proto", fileDescriptor0) } var fileDescriptor0 = []byte{ - // 145 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0x12, 0xc8, 0x4c, 0x49, 0xcd, - 0x2b, 0xc9, 0x2c, 0xc9, 0x4c, 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0xce, 0x2d, - 0x2e, 0x50, 0x72, 0xe1, 0x12, 0x0a, 0x4e, 0x2d, 0xca, 0x4c, 0xcc, 0xc9, 0xac, 0x4a, 0x4d, 0xf1, - 0x84, 0x28, 0xa9, 0x14, 0x12, 0xe1, 0x62, 0xf5, 0x2d, 0x2e, 0xc8, 0x4c, 0x91, 0x60, 0x54, 0x60, - 0xd4, 0xe0, 0x0c, 0x82, 0x70, 0x84, 0x24, 0xb8, 0xd8, 0x3d, 0x53, 0x9c, 0x2a, 0x4b, 0x52, 0x8b, - 0x25, 0x98, 0x14, 0x18, 0x35, 0x78, 0x82, 0x60, 0x5c, 0x27, 0xe5, 0x28, 0xc5, 0xf4, 0xcc, 0x92, - 0x8c, 0xd2, 0x24, 0xbd, 0xe4, 0xfc, 0x5c, 0xfd, 0x8c, 0xca, 0x82, 0xd4, 0xa2, 0x9c, 0xd4, 0x94, - 0xf4, 0xd4, 0x22, 0xfd, 0xb4, 0xc4, 0xa4, 0xa2, 0xcc, 0x64, 0xfd, 0xdc, 0xe2, 0x82, 0x24, 0x36, - 0xb0, 0xb5, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0xdc, 0x7a, 0xe7, 0x45, 0x8a, 0x00, 0x00, - 0x00, + // 152 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0x12, 0xc9, 0x2d, 0x2e, 0xd0, + 0xcf, 0x4c, 0x49, 0xcd, 0x2b, 0xc9, 0x2c, 0xc9, 0x4c, 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, + 0x17, 0x62, 0xce, 0x2d, 0x2e, 0x50, 0x72, 0xe1, 0x12, 0x0a, 0x4e, 0x2d, 0xca, 0x4c, 0xcc, 0xc9, + 0xac, 0x4a, 0x4d, 0xf1, 0x84, 0x28, 0xa9, 0x14, 0x12, 0xe1, 0x62, 0xf5, 0x2d, 0x2e, 0xc8, 0x4c, + 0x91, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x0c, 0x82, 0x70, 0x84, 0x24, 0xb8, 0xd8, 0x3d, 0x53, 0x9c, + 0x2a, 0x4b, 0x52, 0x8b, 0x25, 0x98, 0x14, 0x18, 0x35, 0x78, 0x82, 0x60, 0x5c, 0x27, 0xad, 0x28, + 0x8d, 0xf4, 0xcc, 0x92, 0x8c, 0xd2, 0x24, 0xbd, 0xe4, 0xfc, 0x5c, 0xfd, 0x8c, 0xca, 0x82, 0xd4, + 0xa2, 0x9c, 0xd4, 0x94, 0xf4, 0xd4, 0x22, 0xfd, 0xb4, 0xc4, 0xa4, 0xa2, 0xcc, 0x64, 0x7d, 0xb0, + 0x8d, 0xc5, 0xfa, 0xb9, 0xc5, 0x05, 0x49, 0x6c, 0x60, 0xb6, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, + 0x9f, 0x29, 0x4a, 0xd6, 0x95, 0x00, 0x00, 0x00, } diff --git a/msp/identities.proto b/protos/msp/identities.proto similarity index 93% rename from msp/identities.proto rename to protos/msp/identities.proto index dd37c474ded..0a7a71121d6 100644 --- a/msp/identities.proto +++ b/protos/msp/identities.proto @@ -16,7 +16,7 @@ limitations under the License. syntax = "proto3"; -option go_package = "github.com/hyperledger/fabric/msp"; +option go_package = "github.com/hyperledger/fabric/protos/msp"; package msp; diff --git a/protos/msp/mspconfig.pb.go b/protos/msp/mspconfig.pb.go index 1d7363fa2d6..89c47c31edc 100644 --- a/protos/msp/mspconfig.pb.go +++ b/protos/msp/mspconfig.pb.go @@ -2,19 +2,6 @@ // source: msp/mspconfig.proto // DO NOT EDIT! -/* -Package msp is a generated protocol buffer package. - -It is generated from these files: - msp/mspconfig.proto - -It has these top-level messages: - MSPConfig - FabricMSPConfig - SigningIdentityInfo - KeyInfo - FabricOUIdentifier -*/ package msp import proto "github.com/golang/protobuf/proto" @@ -26,12 +13,6 @@ var _ = proto.Marshal var _ = fmt.Errorf var _ = math.Inf -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package - // MSPConfig collects all the configuration information for // an MSP. The Config field should be unmarshalled in a way // that depends on the Type @@ -46,7 +27,7 @@ type MSPConfig struct { func (m *MSPConfig) Reset() { *m = MSPConfig{} } func (m *MSPConfig) String() string { return proto.CompactTextString(m) } func (*MSPConfig) ProtoMessage() {} -func (*MSPConfig) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } +func (*MSPConfig) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{0} } // FabricMSPConfig collects all the configuration information for // a Fabric MSP. @@ -93,7 +74,7 @@ type FabricMSPConfig struct { func (m *FabricMSPConfig) Reset() { *m = FabricMSPConfig{} } func (m *FabricMSPConfig) String() string { return proto.CompactTextString(m) } func (*FabricMSPConfig) ProtoMessage() {} -func (*FabricMSPConfig) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } +func (*FabricMSPConfig) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{1} } func (m *FabricMSPConfig) GetSigningIdentity() *SigningIdentityInfo { if m != nil { @@ -125,7 +106,7 @@ type SigningIdentityInfo struct { func (m *SigningIdentityInfo) Reset() { *m = SigningIdentityInfo{} } func (m *SigningIdentityInfo) String() string { return proto.CompactTextString(m) } func (*SigningIdentityInfo) ProtoMessage() {} -func (*SigningIdentityInfo) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} } +func (*SigningIdentityInfo) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{2} } func (m *SigningIdentityInfo) GetPrivateSigner() *KeyInfo { if m != nil { @@ -151,7 +132,7 @@ type KeyInfo struct { func (m *KeyInfo) Reset() { *m = KeyInfo{} } func (m *KeyInfo) String() string { return proto.CompactTextString(m) } func (*KeyInfo) ProtoMessage() {} -func (*KeyInfo) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} } +func (*KeyInfo) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{3} } // FabricOUIdentifier represents an organizazional unit and // its related chain of trust identifier. @@ -167,7 +148,7 @@ type FabricOUIdentifier struct { func (m *FabricOUIdentifier) Reset() { *m = FabricOUIdentifier{} } func (m *FabricOUIdentifier) String() string { return proto.CompactTextString(m) } func (*FabricOUIdentifier) ProtoMessage() {} -func (*FabricOUIdentifier) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} } +func (*FabricOUIdentifier) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{4} } func init() { proto.RegisterType((*MSPConfig)(nil), "msp.MSPConfig") @@ -177,9 +158,9 @@ func init() { proto.RegisterType((*FabricOUIdentifier)(nil), "msp.FabricOUIdentifier") } -func init() { proto.RegisterFile("msp/mspconfig.proto", fileDescriptor0) } +func init() { proto.RegisterFile("msp/mspconfig.proto", fileDescriptor1) } -var fileDescriptor0 = []byte{ +var fileDescriptor1 = []byte{ // 458 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x7c, 0x53, 0xdd, 0x6e, 0xd3, 0x30, 0x14, 0x56, 0xda, 0xad, 0x53, 0x4f, 0xd3, 0x16, 0x3c, 0x18, 0xb9, 0x60, 0x10, 0x82, 0x10, 0x11,