From a4e80cd1892e78f4f6c6ee58f395d02bb133b937 Mon Sep 17 00:00:00 2001 From: Jason Yellick Date: Wed, 8 Mar 2017 10:39:41 -0500 Subject: [PATCH] [FAB-2695] (PA) mv msp_principal.proto protos/msp This is intended for (PA) post-alpha. https://jira.hyperledger.org/browse/FAB-2695 Before the proto compilation was fixed to handle importing protos across directories, the msp_principal.proto was put into protos/common/. It does not make sense here, as it is only MSP related, and it belongs in protos/msp/. Note, that is an API change only, no ABI is modified, so this should not impact existing clients until the regenerate the protobufs. Change-Id: I72f52354d76e25237ad4831e8e25d6c9772196f6 Signed-off-by: Jason Yellick --- common/cauthdsl/cauthdsl.go | 3 +- common/cauthdsl/cauthdsl_builder.go | 21 ++--- common/cauthdsl/cauthdsl_test.go | 3 +- common/cauthdsl/policyparser.go | 17 ++-- common/cauthdsl/policyparser_test.go | 75 +++++++++--------- core/policy/mocks.go | 7 +- core/scc/lccc/lccc.go | 9 ++- msp/identities.go | 3 +- msp/mgmt/principal.go | 18 ++--- msp/msp.go | 5 +- msp/msp_test.go | 19 +++-- msp/mspimpl.go | 17 ++-- msp/noopmsp.go | 5 +- peer/gossip/mcs/mocks.go | 3 +- protos/common/common.pb.go | 4 - protos/common/policies.pb.go | 91 +++++++++++----------- protos/common/policies.proto | 2 +- protos/msp/identities.pb.go | 4 + protos/{common => msp}/msp_principal.pb.go | 70 ++++++++--------- protos/{common => msp}/msp_principal.proto | 2 +- protos/msp/mspconfig.pb.go | 14 ++-- 21 files changed, 198 insertions(+), 194 deletions(-) rename protos/{common => msp}/msp_principal.pb.go (72%) rename protos/{common => msp}/msp_principal.proto (98%) diff --git a/common/cauthdsl/cauthdsl.go b/common/cauthdsl/cauthdsl.go index b7a7e09ff99..6587fecc7aa 100644 --- a/common/cauthdsl/cauthdsl.go +++ b/common/cauthdsl/cauthdsl.go @@ -21,13 +21,14 @@ import ( "github.com/hyperledger/fabric/msp" cb "github.com/hyperledger/fabric/protos/common" + mb "github.com/hyperledger/fabric/protos/msp" "github.com/op/go-logging" ) var cauthdslLogger = logging.MustGetLogger("cauthdsl") // compile recursively builds a go evaluatable function corresponding to the policy specified -func compile(policy *cb.SignaturePolicy, identities []*cb.MSPPrincipal, deserializer msp.IdentityDeserializer) (func([]*cb.SignedData, []bool) bool, error) { +func compile(policy *cb.SignaturePolicy, identities []*mb.MSPPrincipal, deserializer msp.IdentityDeserializer) (func([]*cb.SignedData, []bool) bool, error) { switch t := policy.Type.(type) { case *cb.SignaturePolicy_NOutOf_: policies := make([]func([]*cb.SignedData, []bool) bool, len(t.NOutOf.Policies)) diff --git a/common/cauthdsl/cauthdsl_builder.go b/common/cauthdsl/cauthdsl_builder.go index 6852e3323fc..ee5489360d8 100644 --- a/common/cauthdsl/cauthdsl_builder.go +++ b/common/cauthdsl/cauthdsl_builder.go @@ -18,6 +18,7 @@ package cauthdsl import ( cb "github.com/hyperledger/fabric/protos/common" + "github.com/hyperledger/fabric/protos/msp" "github.com/golang/protobuf/proto" "github.com/hyperledger/fabric/protos/utils" @@ -53,9 +54,9 @@ func init() { // Envelope builds an envelope message embedding a SignaturePolicy func Envelope(policy *cb.SignaturePolicy, identities [][]byte) *cb.SignaturePolicyEnvelope { - ids := make([]*cb.MSPPrincipal, len(identities)) + ids := make([]*msp.MSPPrincipal, len(identities)) for i, _ := range ids { - ids[i] = &cb.MSPPrincipal{PrincipalClassification: cb.MSPPrincipal_IDENTITY, Principal: identities[i]} + ids[i] = &msp.MSPPrincipal{PrincipalClassification: msp.MSPPrincipal_IDENTITY, Principal: identities[i]} } return &cb.SignaturePolicyEnvelope{ @@ -78,15 +79,15 @@ func SignedBy(index int32) *cb.SignaturePolicy { // requiring 1 signature from any member of the specified MSP func SignedByMspMember(mspId string) *cb.SignaturePolicyEnvelope { // specify the principal: it's a member of the msp we just found - principal := &cb.MSPPrincipal{ - PrincipalClassification: cb.MSPPrincipal_ROLE, - Principal: utils.MarshalOrPanic(&cb.MSPRole{Role: cb.MSPRole_MEMBER, MspIdentifier: mspId})} + principal := &msp.MSPPrincipal{ + PrincipalClassification: msp.MSPPrincipal_ROLE, + Principal: utils.MarshalOrPanic(&msp.MSPRole{Role: msp.MSPRole_MEMBER, MspIdentifier: mspId})} // create the policy: it requires exactly 1 signature from the first (and only) principal p := &cb.SignaturePolicyEnvelope{ Version: 0, Policy: NOutOf(1, []*cb.SignaturePolicy{SignedBy(0)}), - Identities: []*cb.MSPPrincipal{principal}, + Identities: []*msp.MSPPrincipal{principal}, } return p @@ -96,15 +97,15 @@ func SignedByMspMember(mspId string) *cb.SignaturePolicyEnvelope { // requiring 1 signature from any admin of the specified MSP func SignedByMspAdmin(mspId string) *cb.SignaturePolicyEnvelope { // specify the principal: it's a member of the msp we just found - principal := &cb.MSPPrincipal{ - PrincipalClassification: cb.MSPPrincipal_ROLE, - Principal: utils.MarshalOrPanic(&cb.MSPRole{Role: cb.MSPRole_ADMIN, MspIdentifier: mspId})} + principal := &msp.MSPPrincipal{ + PrincipalClassification: msp.MSPPrincipal_ROLE, + Principal: utils.MarshalOrPanic(&msp.MSPRole{Role: msp.MSPRole_ADMIN, MspIdentifier: mspId})} // create the policy: it requires exactly 1 signature from the first (and only) principal p := &cb.SignaturePolicyEnvelope{ Version: 0, Policy: NOutOf(1, []*cb.SignaturePolicy{SignedBy(0)}), - Identities: []*cb.MSPPrincipal{principal}, + Identities: []*msp.MSPPrincipal{principal}, } return p diff --git a/common/cauthdsl/cauthdsl_test.go b/common/cauthdsl/cauthdsl_test.go index 3b53d9bd079..88cc468abfe 100644 --- a/common/cauthdsl/cauthdsl_test.go +++ b/common/cauthdsl/cauthdsl_test.go @@ -25,6 +25,7 @@ import ( "github.com/golang/protobuf/proto" cb "github.com/hyperledger/fabric/protos/common" + mb "github.com/hyperledger/fabric/protos/msp" ) var invalidSignature = []byte("badsigned") @@ -33,7 +34,7 @@ type mockIdentity struct { idBytes []byte } -func (id *mockIdentity) SatisfiesPrincipal(p *cb.MSPPrincipal) error { +func (id *mockIdentity) SatisfiesPrincipal(p *mb.MSPPrincipal) error { if bytes.Compare(id.idBytes, p.Principal) == 0 { return nil } else { diff --git a/common/cauthdsl/policyparser.go b/common/cauthdsl/policyparser.go index 2f8035f2a6b..170a94e2b78 100644 --- a/common/cauthdsl/policyparser.go +++ b/common/cauthdsl/policyparser.go @@ -24,6 +24,7 @@ import ( "github.com/Knetic/govaluate" "github.com/hyperledger/fabric/protos/common" + "github.com/hyperledger/fabric/protos/msp" "github.com/hyperledger/fabric/protos/utils" ) @@ -138,17 +139,17 @@ func secondPass(args ...interface{}) (interface{}, error) { } /* get the right role */ - var r common.MSPRole_MSPRoleType + var r msp.MSPRole_MSPRoleType if subm[0][3] == "member" { - r = common.MSPRole_MEMBER + r = msp.MSPRole_MEMBER } else { - r = common.MSPRole_ADMIN + r = msp.MSPRole_ADMIN } /* build the principal we've been told */ - p := &common.MSPPrincipal{ - PrincipalClassification: common.MSPPrincipal_ROLE, - Principal: utils.MarshalOrPanic(&common.MSPRole{MspIdentifier: subm[0][1], Role: r})} + p := &msp.MSPPrincipal{ + PrincipalClassification: msp.MSPPrincipal_ROLE, + Principal: utils.MarshalOrPanic(&msp.MSPRole{MspIdentifier: subm[0][1], Role: r})} ctx.principals = append(ctx.principals, p) /* create a SignaturePolicy that requires a signature from @@ -177,11 +178,11 @@ func secondPass(args ...interface{}) (interface{}, error) { type context struct { IDNum int - principals []*common.MSPPrincipal + principals []*msp.MSPPrincipal } func newContext() *context { - return &context{IDNum: 0, principals: make([]*common.MSPPrincipal, 0)} + return &context{IDNum: 0, principals: make([]*msp.MSPPrincipal, 0)} } // FromString takes a string representation of the policy, diff --git a/common/cauthdsl/policyparser_test.go b/common/cauthdsl/policyparser_test.go index ab27c1b8c0f..4b5943ce085 100644 --- a/common/cauthdsl/policyparser_test.go +++ b/common/cauthdsl/policyparser_test.go @@ -21,6 +21,7 @@ import ( "testing" "github.com/hyperledger/fabric/protos/common" + "github.com/hyperledger/fabric/protos/msp" "github.com/hyperledger/fabric/protos/utils" "github.com/stretchr/testify/assert" ) @@ -29,15 +30,15 @@ func TestAnd(t *testing.T) { p1, err := FromString("AND('A.member', 'B.member')") assert.NoError(t, err) - principals := make([]*common.MSPPrincipal, 0) + principals := make([]*msp.MSPPrincipal, 0) - principals = append(principals, &common.MSPPrincipal{ - PrincipalClassification: common.MSPPrincipal_ROLE, - Principal: utils.MarshalOrPanic(&common.MSPRole{Role: common.MSPRole_MEMBER, MspIdentifier: "A"})}) + principals = append(principals, &msp.MSPPrincipal{ + PrincipalClassification: msp.MSPPrincipal_ROLE, + Principal: utils.MarshalOrPanic(&msp.MSPRole{Role: msp.MSPRole_MEMBER, MspIdentifier: "A"})}) - principals = append(principals, &common.MSPPrincipal{ - PrincipalClassification: common.MSPPrincipal_ROLE, - Principal: utils.MarshalOrPanic(&common.MSPRole{Role: common.MSPRole_MEMBER, MspIdentifier: "B"})}) + principals = append(principals, &msp.MSPPrincipal{ + PrincipalClassification: msp.MSPPrincipal_ROLE, + Principal: utils.MarshalOrPanic(&msp.MSPRole{Role: msp.MSPRole_MEMBER, MspIdentifier: "B"})}) p2 := &common.SignaturePolicyEnvelope{ Version: 0, @@ -52,15 +53,15 @@ func TestOr(t *testing.T) { p1, err := FromString("OR('A.member', 'B.member')") assert.NoError(t, err) - principals := make([]*common.MSPPrincipal, 0) + principals := make([]*msp.MSPPrincipal, 0) - principals = append(principals, &common.MSPPrincipal{ - PrincipalClassification: common.MSPPrincipal_ROLE, - Principal: utils.MarshalOrPanic(&common.MSPRole{Role: common.MSPRole_MEMBER, MspIdentifier: "A"})}) + principals = append(principals, &msp.MSPPrincipal{ + PrincipalClassification: msp.MSPPrincipal_ROLE, + Principal: utils.MarshalOrPanic(&msp.MSPRole{Role: msp.MSPRole_MEMBER, MspIdentifier: "A"})}) - principals = append(principals, &common.MSPPrincipal{ - PrincipalClassification: common.MSPPrincipal_ROLE, - Principal: utils.MarshalOrPanic(&common.MSPRole{Role: common.MSPRole_MEMBER, MspIdentifier: "B"})}) + principals = append(principals, &msp.MSPPrincipal{ + PrincipalClassification: msp.MSPPrincipal_ROLE, + Principal: utils.MarshalOrPanic(&msp.MSPRole{Role: msp.MSPRole_MEMBER, MspIdentifier: "B"})}) p2 := &common.SignaturePolicyEnvelope{ Version: 0, @@ -75,19 +76,19 @@ func TestComplex1(t *testing.T) { p1, err := FromString("OR('A.member', AND('B.member', 'C.member'))") assert.NoError(t, err) - principals := make([]*common.MSPPrincipal, 0) + principals := make([]*msp.MSPPrincipal, 0) - principals = append(principals, &common.MSPPrincipal{ - PrincipalClassification: common.MSPPrincipal_ROLE, - Principal: utils.MarshalOrPanic(&common.MSPRole{Role: common.MSPRole_MEMBER, MspIdentifier: "B"})}) + principals = append(principals, &msp.MSPPrincipal{ + PrincipalClassification: msp.MSPPrincipal_ROLE, + Principal: utils.MarshalOrPanic(&msp.MSPRole{Role: msp.MSPRole_MEMBER, MspIdentifier: "B"})}) - principals = append(principals, &common.MSPPrincipal{ - PrincipalClassification: common.MSPPrincipal_ROLE, - Principal: utils.MarshalOrPanic(&common.MSPRole{Role: common.MSPRole_MEMBER, MspIdentifier: "C"})}) + principals = append(principals, &msp.MSPPrincipal{ + PrincipalClassification: msp.MSPPrincipal_ROLE, + Principal: utils.MarshalOrPanic(&msp.MSPRole{Role: msp.MSPRole_MEMBER, MspIdentifier: "C"})}) - principals = append(principals, &common.MSPPrincipal{ - PrincipalClassification: common.MSPPrincipal_ROLE, - Principal: utils.MarshalOrPanic(&common.MSPRole{Role: common.MSPRole_MEMBER, MspIdentifier: "A"})}) + principals = append(principals, &msp.MSPPrincipal{ + PrincipalClassification: msp.MSPPrincipal_ROLE, + Principal: utils.MarshalOrPanic(&msp.MSPRole{Role: msp.MSPRole_MEMBER, MspIdentifier: "A"})}) p2 := &common.SignaturePolicyEnvelope{ Version: 0, @@ -102,23 +103,23 @@ func TestComplex2(t *testing.T) { p1, err := FromString("OR(AND('A.member', 'B.member'), OR('C.admin', 'D.member'))") assert.NoError(t, err) - principals := make([]*common.MSPPrincipal, 0) + principals := make([]*msp.MSPPrincipal, 0) - principals = append(principals, &common.MSPPrincipal{ - PrincipalClassification: common.MSPPrincipal_ROLE, - Principal: utils.MarshalOrPanic(&common.MSPRole{Role: common.MSPRole_MEMBER, MspIdentifier: "A"})}) + principals = append(principals, &msp.MSPPrincipal{ + PrincipalClassification: msp.MSPPrincipal_ROLE, + Principal: utils.MarshalOrPanic(&msp.MSPRole{Role: msp.MSPRole_MEMBER, MspIdentifier: "A"})}) - principals = append(principals, &common.MSPPrincipal{ - PrincipalClassification: common.MSPPrincipal_ROLE, - Principal: utils.MarshalOrPanic(&common.MSPRole{Role: common.MSPRole_MEMBER, MspIdentifier: "B"})}) + principals = append(principals, &msp.MSPPrincipal{ + PrincipalClassification: msp.MSPPrincipal_ROLE, + Principal: utils.MarshalOrPanic(&msp.MSPRole{Role: msp.MSPRole_MEMBER, MspIdentifier: "B"})}) - principals = append(principals, &common.MSPPrincipal{ - PrincipalClassification: common.MSPPrincipal_ROLE, - Principal: utils.MarshalOrPanic(&common.MSPRole{Role: common.MSPRole_ADMIN, MspIdentifier: "C"})}) + principals = append(principals, &msp.MSPPrincipal{ + PrincipalClassification: msp.MSPPrincipal_ROLE, + Principal: utils.MarshalOrPanic(&msp.MSPRole{Role: msp.MSPRole_ADMIN, MspIdentifier: "C"})}) - principals = append(principals, &common.MSPPrincipal{ - PrincipalClassification: common.MSPPrincipal_ROLE, - Principal: utils.MarshalOrPanic(&common.MSPRole{Role: common.MSPRole_MEMBER, MspIdentifier: "D"})}) + principals = append(principals, &msp.MSPPrincipal{ + PrincipalClassification: msp.MSPPrincipal_ROLE, + Principal: utils.MarshalOrPanic(&msp.MSPRole{Role: msp.MSPRole_MEMBER, MspIdentifier: "D"})}) p2 := &common.SignaturePolicyEnvelope{ Version: 0, diff --git a/core/policy/mocks.go b/core/policy/mocks.go index c4f4c0e97e7..af4ad0e2abf 100644 --- a/core/policy/mocks.go +++ b/core/policy/mocks.go @@ -26,6 +26,7 @@ import ( "github.com/hyperledger/fabric/common/policies" "github.com/hyperledger/fabric/msp" "github.com/hyperledger/fabric/protos/common" + mspproto "github.com/hyperledger/fabric/protos/msp" ) type mockChannelPolicyManagerGetter struct { @@ -91,7 +92,7 @@ type mockIdentity struct { msg []byte } -func (id *mockIdentity) SatisfiesPrincipal(p *common.MSPPrincipal) error { +func (id *mockIdentity) SatisfiesPrincipal(p *mspproto.MSPPrincipal) error { if !bytes.Equal(id.identity, p.Principal) { return fmt.Errorf("Different identities [% x]!=[% x]", id.identity, p.Principal) } @@ -141,6 +142,6 @@ type mockMSPPrincipalGetter struct { Principal []byte } -func (m *mockMSPPrincipalGetter) Get(role string) (*common.MSPPrincipal, error) { - return &common.MSPPrincipal{Principal: m.Principal}, nil +func (m *mockMSPPrincipalGetter) Get(role string) (*mspproto.MSPPrincipal, error) { + return &mspproto.MSPPrincipal{Principal: m.Principal}, nil } diff --git a/core/scc/lccc/lccc.go b/core/scc/lccc/lccc.go index 57862c57f1e..2147819df41 100644 --- a/core/scc/lccc/lccc.go +++ b/core/scc/lccc/lccc.go @@ -29,6 +29,7 @@ import ( "github.com/hyperledger/fabric/core/common/sysccprovider" "github.com/hyperledger/fabric/core/peer" "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" @@ -481,12 +482,12 @@ func (lccc *LifeCycleSysCC) getDefaultEndorsementPolicy(chain string) []byte { // per application MSP defined on this chain ids := peer.GetMSPIDs(chain) sort.Strings(ids) - principals := make([]*common.MSPPrincipal, len(ids)) + principals := make([]*mspprotos.MSPPrincipal, len(ids)) sigspolicy := make([]*common.SignaturePolicy, len(ids)) for i, id := range ids { - principals[i] = &common.MSPPrincipal{ - PrincipalClassification: common.MSPPrincipal_ROLE, - Principal: utils.MarshalOrPanic(&common.MSPRole{Role: common.MSPRole_MEMBER, MspIdentifier: id})} + principals[i] = &mspprotos.MSPPrincipal{ + PrincipalClassification: mspprotos.MSPPrincipal_ROLE, + Principal: utils.MarshalOrPanic(&mspprotos.MSPRole{Role: mspprotos.MSPRole_MEMBER, MspIdentifier: id})} sigspolicy[i] = cauthdsl.SignedBy(int32(i)) } diff --git a/msp/identities.go b/msp/identities.go index 1619e38e09f..3072f3fd1d2 100644 --- a/msp/identities.go +++ b/msp/identities.go @@ -27,7 +27,6 @@ import ( "github.com/golang/protobuf/proto" "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" ) @@ -52,7 +51,7 @@ func newIdentity(id *IdentityIdentifier, cert *x509.Certificate, pk bccsp.Key, m } // SatisfiesPrincipal returns null if this instance matches the supplied principal or an error otherwise -func (id *identity) SatisfiesPrincipal(principal *common.MSPPrincipal) error { +func (id *identity) SatisfiesPrincipal(principal *msp.MSPPrincipal) error { return id.msp.SatisfiesPrincipal(id, principal) } diff --git a/msp/mgmt/principal.go b/msp/mgmt/principal.go index 1e4cb0cdd97..46592ee3441 100644 --- a/msp/mgmt/principal.go +++ b/msp/mgmt/principal.go @@ -20,12 +20,12 @@ import ( "fmt" "github.com/golang/protobuf/proto" - "github.com/hyperledger/fabric/protos/common" + "github.com/hyperledger/fabric/protos/msp" ) type MSPPrincipalGetter interface { // Get returns an MSP principal for the given role - Get(role string) (*common.MSPPrincipal, error) + Get(role string) (*msp.MSPPrincipal, error) } func NewLocalMSPPrincipalGetter() MSPPrincipalGetter { @@ -34,7 +34,7 @@ func NewLocalMSPPrincipalGetter() MSPPrincipalGetter { type localMSPPrincipalGetter struct{} -func (m *localMSPPrincipalGetter) Get(role string) (*common.MSPPrincipal, error) { +func (m *localMSPPrincipalGetter) Get(role string) (*msp.MSPPrincipal, error) { mspid, err := GetLocalMSP().GetIdentifier() if err != nil { return nil, fmt.Errorf("Could not extract local msp identifier [%s]", err) @@ -43,22 +43,22 @@ func (m *localMSPPrincipalGetter) Get(role string) (*common.MSPPrincipal, error) // TODO: put the constants in some more appropriate place switch role { case "admin": - principalBytes, err := proto.Marshal(&common.MSPRole{Role: common.MSPRole_ADMIN, MspIdentifier: mspid}) + principalBytes, err := proto.Marshal(&msp.MSPRole{Role: msp.MSPRole_ADMIN, MspIdentifier: mspid}) if err != nil { return nil, err } - return &common.MSPPrincipal{ - PrincipalClassification: common.MSPPrincipal_ROLE, + return &msp.MSPPrincipal{ + PrincipalClassification: msp.MSPPrincipal_ROLE, Principal: principalBytes}, nil case "member": - principalBytes, err := proto.Marshal(&common.MSPRole{Role: common.MSPRole_MEMBER, MspIdentifier: mspid}) + principalBytes, err := proto.Marshal(&msp.MSPRole{Role: msp.MSPRole_MEMBER, MspIdentifier: mspid}) if err != nil { return nil, err } - return &common.MSPPrincipal{ - PrincipalClassification: common.MSPPrincipal_ROLE, + return &msp.MSPPrincipal{ + PrincipalClassification: msp.MSPPrincipal_ROLE, Principal: principalBytes}, nil default: return nil, fmt.Errorf("MSP Principal role [%s] not recognized.", role) diff --git a/msp/msp.go b/msp/msp.go index f1aabb5bff2..01635abafb1 100644 --- a/msp/msp.go +++ b/msp/msp.go @@ -17,7 +17,6 @@ limitations under the License. package msp import ( - "github.com/hyperledger/fabric/protos/common" "github.com/hyperledger/fabric/protos/msp" ) @@ -100,7 +99,7 @@ type MSP interface { // the description supplied in MSPPrincipal. The check may // involve a byte-by-byte comparison (if the principal is // a serialized identity) or may require MSP validation - SatisfiesPrincipal(id Identity, principal *common.MSPPrincipal) error + SatisfiesPrincipal(id Identity, principal *msp.MSPPrincipal) error } // From this point on, there are interfaces that are shared within the peer and client API @@ -156,7 +155,7 @@ type Identity interface { // the description supplied in MSPPrincipal. The check may // involve a byte-by-byte comparison (if the principal is // a serialized identity) or may require MSP validation - SatisfiesPrincipal(principal *common.MSPPrincipal) error + SatisfiesPrincipal(principal *msp.MSPPrincipal) error } // SigningIdentity is an extension of Identity to cover signing capabilities. diff --git a/msp/msp_test.go b/msp/msp_test.go index 09b461f4a94..714d31591e2 100644 --- a/msp/msp_test.go +++ b/msp/msp_test.go @@ -24,7 +24,6 @@ import ( "fmt" "github.com/golang/protobuf/proto" - "github.com/hyperledger/fabric/protos/common" "github.com/hyperledger/fabric/protos/msp" "github.com/stretchr/testify/assert" ) @@ -264,12 +263,12 @@ func TestOUPolicyPrincipal(t *testing.T) { id, err := localMsp.GetDefaultSigningIdentity() assert.NoError(t, err) - ou := &common.OrganizationUnit{OrganizationalUnitIdentifier: "COP", MspIdentifier: "DEFAULT"} + ou := &msp.OrganizationUnit{OrganizationalUnitIdentifier: "COP", MspIdentifier: "DEFAULT"} bytes, err := proto.Marshal(ou) assert.NoError(t, err) - principal := &common.MSPPrincipal{ - PrincipalClassification: common.MSPPrincipal_ORGANIZATION_UNIT, + principal := &msp.MSPPrincipal{ + PrincipalClassification: msp.MSPPrincipal_ORGANIZATION_UNIT, Principal: bytes, } @@ -281,11 +280,11 @@ func TestAdminPolicyPrincipal(t *testing.T) { id, err := localMsp.GetDefaultSigningIdentity() assert.NoError(t, err) - principalBytes, err := proto.Marshal(&common.MSPRole{Role: common.MSPRole_ADMIN, MspIdentifier: "DEFAULT"}) + principalBytes, err := proto.Marshal(&msp.MSPRole{Role: msp.MSPRole_ADMIN, MspIdentifier: "DEFAULT"}) assert.NoError(t, err) - principal := &common.MSPPrincipal{ - PrincipalClassification: common.MSPPrincipal_ROLE, + principal := &msp.MSPPrincipal{ + PrincipalClassification: msp.MSPPrincipal_ROLE, Principal: principalBytes} err = id.SatisfiesPrincipal(principal) @@ -296,11 +295,11 @@ func TestAdminPolicyPrincipalFails(t *testing.T) { id, err := localMsp.GetDefaultSigningIdentity() assert.NoError(t, err) - principalBytes, err := proto.Marshal(&common.MSPRole{Role: common.MSPRole_ADMIN, MspIdentifier: "DEFAULT"}) + principalBytes, err := proto.Marshal(&msp.MSPRole{Role: msp.MSPRole_ADMIN, MspIdentifier: "DEFAULT"}) assert.NoError(t, err) - principal := &common.MSPPrincipal{ - PrincipalClassification: common.MSPPrincipal_ROLE, + principal := &msp.MSPPrincipal{ + PrincipalClassification: msp.MSPPrincipal_ROLE, Principal: principalBytes} // remove the admin so validation will fail diff --git a/msp/mspimpl.go b/msp/mspimpl.go index 023ae7e6782..68d0ff5e696 100644 --- a/msp/mspimpl.go +++ b/msp/mspimpl.go @@ -32,7 +32,6 @@ import ( "github.com/hyperledger/fabric/bccsp" "github.com/hyperledger/fabric/bccsp/factory" "github.com/hyperledger/fabric/bccsp/signer" - "github.com/hyperledger/fabric/protos/common" m "github.com/hyperledger/fabric/protos/msp" ) @@ -525,13 +524,13 @@ func (msp *bccspmsp) deserializeIdentityInternal(serializedIdentity []byte) (Ide } // SatisfiesPrincipal returns null if the identity matches the principal or an error otherwise -func (msp *bccspmsp) SatisfiesPrincipal(id Identity, principal *common.MSPPrincipal) error { +func (msp *bccspmsp) SatisfiesPrincipal(id Identity, principal *m.MSPPrincipal) error { switch principal.PrincipalClassification { // in this case, we have to check whether the // identity has a role in the msp - member or admin - case common.MSPPrincipal_ROLE: + case m.MSPPrincipal_ROLE: // Principal contains the msp role - mspRole := &common.MSPRole{} + mspRole := &m.MSPRole{} err := proto.Unmarshal(principal.Principal, mspRole) if err != nil { return fmt.Errorf("Could not unmarshal MSPRole from principal, err %s", err) @@ -545,11 +544,11 @@ func (msp *bccspmsp) SatisfiesPrincipal(id Identity, principal *common.MSPPrinci // now we validate the different msp roles switch mspRole.Role { - case common.MSPRole_MEMBER: + case m.MSPRole_MEMBER: // in the case of member, we simply check // whether this identity is valid for the MSP return msp.Validate(id) - case common.MSPRole_ADMIN: + case m.MSPRole_ADMIN: // in the case of admin, we check that the // id is exactly one of our admins idBytes, err := id.Serialize() @@ -575,7 +574,7 @@ func (msp *bccspmsp) SatisfiesPrincipal(id Identity, principal *common.MSPPrinci } // in this case we have to serialize this instance // and compare it byte-by-byte with Principal - case common.MSPPrincipal_IDENTITY: + case m.MSPPrincipal_IDENTITY: idBytes, err := id.Serialize() if err != nil { return fmt.Errorf("Could not serialize this identity instance, err %s", err) @@ -587,9 +586,9 @@ func (msp *bccspmsp) SatisfiesPrincipal(id Identity, principal *common.MSPPrinci } else { return errors.New("The identities do not match") } - case common.MSPPrincipal_ORGANIZATION_UNIT: + case m.MSPPrincipal_ORGANIZATION_UNIT: // Principal contains the OrganizationUnit - OU := &common.OrganizationUnit{} + OU := &m.OrganizationUnit{} err := proto.Unmarshal(principal.Principal, OU) if err != nil { return fmt.Errorf("Could not unmarshal OrganizationUnit from principal, err %s", err) diff --git a/msp/noopmsp.go b/msp/noopmsp.go index b35e13e49a4..f4406d12d78 100644 --- a/msp/noopmsp.go +++ b/msp/noopmsp.go @@ -17,7 +17,6 @@ limitations under the License. package msp import ( - "github.com/hyperledger/fabric/protos/common" "github.com/hyperledger/fabric/protos/msp" ) @@ -73,7 +72,7 @@ func (msp *noopmsp) Validate(id Identity) error { return nil } -func (msp *noopmsp) SatisfiesPrincipal(id Identity, principal *common.MSPPrincipal) error { +func (msp *noopmsp) SatisfiesPrincipal(id Identity, principal *msp.MSPPrincipal) error { return nil } @@ -85,7 +84,7 @@ func newNoopIdentity() (Identity, error) { return &noopidentity{}, nil } -func (id *noopidentity) SatisfiesPrincipal(*common.MSPPrincipal) error { +func (id *noopidentity) SatisfiesPrincipal(*msp.MSPPrincipal) error { return nil } diff --git a/peer/gossip/mcs/mocks.go b/peer/gossip/mcs/mocks.go index 7d452685b6f..22c9d946b40 100644 --- a/peer/gossip/mcs/mocks.go +++ b/peer/gossip/mcs/mocks.go @@ -27,6 +27,7 @@ import ( "github.com/hyperledger/fabric/common/policies" "github.com/hyperledger/fabric/msp" "github.com/hyperledger/fabric/protos/common" + mspproto "github.com/hyperledger/fabric/protos/msp" ) type MockChannelPolicyManagerGetter struct{} @@ -114,7 +115,7 @@ type mockIdentity struct { msg []byte } -func (id *mockIdentity) SatisfiesPrincipal(*common.MSPPrincipal) error { +func (id *mockIdentity) SatisfiesPrincipal(*mspproto.MSPPrincipal) error { return nil } diff --git a/protos/common/common.pb.go b/protos/common/common.pb.go index d6b4524c60d..cdfd8421541 100644 --- a/protos/common/common.pb.go +++ b/protos/common/common.pb.go @@ -10,7 +10,6 @@ It is generated from these files: common/configtx.proto common/configuration.proto common/ledger.proto - common/msp_principal.proto common/policies.proto It has these top-level messages: @@ -41,9 +40,6 @@ It has these top-level messages: BlockDataHashingStructure OrdererAddresses BlockchainInfo - MSPPrincipal - OrganizationUnit - MSPRole Policy SignaturePolicyEnvelope SignaturePolicy diff --git a/protos/common/policies.pb.go b/protos/common/policies.pb.go index bb280ad3c76..14e57429b3f 100644 --- a/protos/common/policies.pb.go +++ b/protos/common/policies.pb.go @@ -7,6 +7,7 @@ package common import proto "github.com/golang/protobuf/proto" import fmt "fmt" import math "math" +import common1 "github.com/hyperledger/fabric/protos/msp" // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal @@ -38,7 +39,7 @@ var Policy_PolicyType_value = map[string]int32{ func (x Policy_PolicyType) String() string { return proto.EnumName(Policy_PolicyType_name, int32(x)) } -func (Policy_PolicyType) EnumDescriptor() ([]byte, []int) { return fileDescriptor5, []int{0, 0} } +func (Policy_PolicyType) EnumDescriptor() ([]byte, []int) { return fileDescriptor4, []int{0, 0} } type ImplicitMetaPolicy_Rule int32 @@ -62,7 +63,7 @@ var ImplicitMetaPolicy_Rule_value = map[string]int32{ func (x ImplicitMetaPolicy_Rule) String() string { return proto.EnumName(ImplicitMetaPolicy_Rule_name, int32(x)) } -func (ImplicitMetaPolicy_Rule) EnumDescriptor() ([]byte, []int) { return fileDescriptor5, []int{3, 0} } +func (ImplicitMetaPolicy_Rule) EnumDescriptor() ([]byte, []int) { return fileDescriptor4, []int{3, 0} } // Policy expresses a policy which the orderer can evaluate, because there has been some desire expressed to support // multiple policy engines, this is typed as a oneof for now @@ -74,19 +75,19 @@ type Policy struct { func (m *Policy) Reset() { *m = Policy{} } func (m *Policy) String() string { return proto.CompactTextString(m) } func (*Policy) ProtoMessage() {} -func (*Policy) Descriptor() ([]byte, []int) { return fileDescriptor5, []int{0} } +func (*Policy) Descriptor() ([]byte, []int) { return fileDescriptor4, []int{0} } // SignaturePolicyEnvelope wraps a SignaturePolicy and includes a version for future enhancements type SignaturePolicyEnvelope struct { - Version int32 `protobuf:"varint,1,opt,name=version" json:"version,omitempty"` - Policy *SignaturePolicy `protobuf:"bytes,2,opt,name=policy" json:"policy,omitempty"` - Identities []*MSPPrincipal `protobuf:"bytes,3,rep,name=identities" json:"identities,omitempty"` + Version int32 `protobuf:"varint,1,opt,name=version" json:"version,omitempty"` + Policy *SignaturePolicy `protobuf:"bytes,2,opt,name=policy" json:"policy,omitempty"` + Identities []*common1.MSPPrincipal `protobuf:"bytes,3,rep,name=identities" json:"identities,omitempty"` } func (m *SignaturePolicyEnvelope) Reset() { *m = SignaturePolicyEnvelope{} } func (m *SignaturePolicyEnvelope) String() string { return proto.CompactTextString(m) } func (*SignaturePolicyEnvelope) ProtoMessage() {} -func (*SignaturePolicyEnvelope) Descriptor() ([]byte, []int) { return fileDescriptor5, []int{1} } +func (*SignaturePolicyEnvelope) Descriptor() ([]byte, []int) { return fileDescriptor4, []int{1} } func (m *SignaturePolicyEnvelope) GetPolicy() *SignaturePolicy { if m != nil { @@ -95,7 +96,7 @@ func (m *SignaturePolicyEnvelope) GetPolicy() *SignaturePolicy { return nil } -func (m *SignaturePolicyEnvelope) GetIdentities() []*MSPPrincipal { +func (m *SignaturePolicyEnvelope) GetIdentities() []*common1.MSPPrincipal { if m != nil { return m.Identities } @@ -118,7 +119,7 @@ type SignaturePolicy struct { func (m *SignaturePolicy) Reset() { *m = SignaturePolicy{} } func (m *SignaturePolicy) String() string { return proto.CompactTextString(m) } func (*SignaturePolicy) ProtoMessage() {} -func (*SignaturePolicy) Descriptor() ([]byte, []int) { return fileDescriptor5, []int{2} } +func (*SignaturePolicy) Descriptor() ([]byte, []int) { return fileDescriptor4, []int{2} } type isSignaturePolicy_Type interface { isSignaturePolicy_Type() @@ -232,7 +233,7 @@ type SignaturePolicy_NOutOf struct { func (m *SignaturePolicy_NOutOf) Reset() { *m = SignaturePolicy_NOutOf{} } func (m *SignaturePolicy_NOutOf) String() string { return proto.CompactTextString(m) } func (*SignaturePolicy_NOutOf) ProtoMessage() {} -func (*SignaturePolicy_NOutOf) Descriptor() ([]byte, []int) { return fileDescriptor5, []int{2, 0} } +func (*SignaturePolicy_NOutOf) Descriptor() ([]byte, []int) { return fileDescriptor4, []int{2, 0} } func (m *SignaturePolicy_NOutOf) GetPolicies() []*SignaturePolicy { if m != nil { @@ -257,7 +258,7 @@ type ImplicitMetaPolicy struct { func (m *ImplicitMetaPolicy) Reset() { *m = ImplicitMetaPolicy{} } func (m *ImplicitMetaPolicy) String() string { return proto.CompactTextString(m) } func (*ImplicitMetaPolicy) ProtoMessage() {} -func (*ImplicitMetaPolicy) Descriptor() ([]byte, []int) { return fileDescriptor5, []int{3} } +func (*ImplicitMetaPolicy) Descriptor() ([]byte, []int) { return fileDescriptor4, []int{3} } func init() { proto.RegisterType((*Policy)(nil), "common.Policy") @@ -269,38 +270,38 @@ func init() { proto.RegisterEnum("common.ImplicitMetaPolicy_Rule", ImplicitMetaPolicy_Rule_name, ImplicitMetaPolicy_Rule_value) } -func init() { proto.RegisterFile("common/policies.proto", fileDescriptor5) } - -var fileDescriptor5 = []byte{ - // 465 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x74, 0x52, 0x51, 0x8f, 0xd2, 0x40, - 0x10, 0x66, 0x01, 0x0b, 0x0c, 0x9c, 0xd6, 0x8d, 0x7a, 0x84, 0x44, 0x25, 0x7d, 0x30, 0x24, 0xc6, - 0x36, 0x01, 0x9f, 0x7c, 0x03, 0x25, 0x5e, 0x3d, 0x5a, 0x9a, 0xa5, 0x17, 0x73, 0xbe, 0x34, 0x14, - 0x16, 0x6e, 0x93, 0xb2, 0x6d, 0xda, 0xed, 0x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e, 0xbc, 0x3f, 0x32, 0x71, 0x93, 0x87, 0x25, 0xad, 0x75, 0x53, 0x24, 0x34, 0x8d, - 0xe8, 0xfe, 0x48, 0x53, 0xeb, 0xb0, 0x0d, 0x53, 0xb6, 0xb3, 0xe4, 0xb7, 0xcc, 0x2c, 0x35, 0x34, - 0xd4, 0x64, 0x3a, 0xfb, 0x1b, 0x00, 0x00, 0xff, 0xff, 0x65, 0xc7, 0x38, 0xb7, 0xe2, 0x02, 0x00, - 0x00, +func init() { proto.RegisterFile("common/policies.proto", fileDescriptor4) } + +var fileDescriptor4 = []byte{ + // 466 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x74, 0x52, 0x5d, 0x8f, 0xd2, 0x40, + 0x14, 0x65, 0x00, 0x0b, 0x5c, 0x58, 0xad, 0x13, 0x95, 0x66, 0x13, 0x95, 0xf4, 0xc1, 0x90, 0x18, + 0xdb, 0x04, 0x7c, 0xf2, 0x0d, 0x94, 0xb8, 0x75, 0x69, 0x69, 0x86, 0x6e, 0xcc, 0xfa, 0xd2, 0x50, + 0x18, 0xd8, 0x49, 0xda, 0xe9, 0xa4, 0x9d, 0x6e, 0x52, 0x7f, 0x85, 0xcf, 0xfe, 0x1b, 0xff, 0x99, + 0xe9, 0xd7, 0x46, 0x77, 0xb3, 0x6f, 0xf7, 0x9e, 0x9e, 0x7b, 0xee, 0x39, 0x73, 0x0b, 0x2f, 0xf7, + 0x71, 0x14, 0xc5, 0xdc, 0x14, 0x71, 0xc8, 0xf6, 0x8c, 0xa6, 0x86, 0x48, 0x62, 0x19, 0x63, 0xa5, + 0x82, 0xcf, 0xc7, 0x51, 0x2a, 0xcc, 0x28, 0x15, 0xbe, 0x48, 0x18, 0xdf, 0x33, 0xb1, 0x0b, 0x2b, + 0x82, 0xfe, 0x13, 0x14, 0xb7, 0x18, 0xc9, 0x31, 0x86, 0xae, 0xcc, 0x05, 0xd5, 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9b, 0x4c, 0x6e, 0x8e, 0x17, 0x2d, 0xa2, 0xf0, 0xb2, 0x3a, 0xbf, 0x04, 0xa5, 0xc2, 0xf0, + 0x08, 0x50, 0x93, 0x19, 0x71, 0x3c, 0x87, 0x7e, 0x73, 0x52, 0xad, 0x5d, 0x5a, 0x7f, 0x34, 0xef, + 0x1d, 0x71, 0xa9, 0x40, 0xb7, 0x38, 0x8c, 0xfe, 0x0b, 0x01, 0xb6, 0x22, 0x51, 0xa0, 0xd2, 0xa6, + 0x72, 0x77, 0x17, 0x03, 0xd2, 0x2c, 0xf0, 0xeb, 0x57, 0x2c, 0x56, 0x0d, 0xc8, 0x20, 0xcd, 0x82, + 0xfa, 0xf3, 0x1c, 0xba, 0x49, 0x16, 0xd2, 0x32, 0xc2, 0xd3, 0xd9, 0xdb, 0x66, 0xdd, 0x43, 0x21, + 0x83, 0x64, 0x21, 0x25, 0x25, 0x59, 0x7f, 0x07, 0xdd, 0xa2, 0x2b, 0xee, 0xbd, 0x70, 0xae, 0xd5, + 0x56, 0x59, 0xac, 0xd7, 0x2a, 0xc2, 0x23, 0xe8, 0xdb, 0x8b, 0x6f, 0x1b, 0x62, 0x79, 0xd7, 0x6a, + 0x7b, 0xf9, 0xe1, 0xc7, 0xfb, 0x13, 0x93, 0x37, 0x59, 0x50, 0xc8, 0x9a, 0x37, 0xb9, 0xa0, 0x49, + 0x48, 0x0f, 0x27, 0x9a, 0x98, 0xc7, 0x5d, 0x90, 0xb0, 0xbd, 0x59, 0xfe, 0x96, 0xa9, 0x59, 0x2d, + 0x0d, 0x94, 0xb2, 0x9d, 0xff, 0x0d, 0x00, 0x00, 0xff, 0xff, 0xf1, 0x13, 0x57, 0x22, 0xdf, 0x02, + 0x00, 0x00, } diff --git a/protos/common/policies.proto b/protos/common/policies.proto index a2b66f9289a..5f2c6b38ec7 100644 --- a/protos/common/policies.proto +++ b/protos/common/policies.proto @@ -16,7 +16,7 @@ limitations under the License. syntax = "proto3"; -import "common/msp_principal.proto"; +import "msp/msp_principal.proto"; option go_package = "github.com/hyperledger/fabric/protos/common"; diff --git a/protos/msp/identities.pb.go b/protos/msp/identities.pb.go index 2cc3a04267f..73cb169d136 100644 --- a/protos/msp/identities.pb.go +++ b/protos/msp/identities.pb.go @@ -7,10 +7,14 @@ Package msp is a generated protocol buffer package. It is generated from these files: msp/identities.proto + msp/msp_principal.proto msp/mspconfig.proto It has these top-level messages: SerializedIdentity + MSPPrincipal + OrganizationUnit + MSPRole MSPConfig FabricMSPConfig SigningIdentityInfo diff --git a/protos/common/msp_principal.pb.go b/protos/msp/msp_principal.pb.go similarity index 72% rename from protos/common/msp_principal.pb.go rename to protos/msp/msp_principal.pb.go index 1390478e596..5345e6be386 100644 --- a/protos/common/msp_principal.pb.go +++ b/protos/msp/msp_principal.pb.go @@ -1,8 +1,8 @@ // Code generated by protoc-gen-go. -// source: common/msp_principal.proto +// source: msp/msp_principal.proto // DO NOT EDIT! -package common +package msp import proto "github.com/golang/protobuf/proto" import fmt "fmt" @@ -41,7 +41,7 @@ func (x MSPPrincipal_Classification) String() string { return proto.EnumName(MSPPrincipal_Classification_name, int32(x)) } func (MSPPrincipal_Classification) EnumDescriptor() ([]byte, []int) { - return fileDescriptor4, []int{0, 0} + return fileDescriptor1, []int{0, 0} } type MSPRole_MSPRoleType int32 @@ -63,7 +63,7 @@ var MSPRole_MSPRoleType_value = map[string]int32{ func (x MSPRole_MSPRoleType) String() string { return proto.EnumName(MSPRole_MSPRoleType_name, int32(x)) } -func (MSPRole_MSPRoleType) EnumDescriptor() ([]byte, []int) { return fileDescriptor4, []int{2, 0} } +func (MSPRole_MSPRoleType) EnumDescriptor() ([]byte, []int) { return fileDescriptor1, []int{2, 0} } // MSPPrincipal aims to represent an MSP-centric set of identities. // In particular, this structure allows for definition of @@ -103,7 +103,7 @@ type MSPPrincipal struct { func (m *MSPPrincipal) Reset() { *m = MSPPrincipal{} } func (m *MSPPrincipal) String() string { return proto.CompactTextString(m) } func (*MSPPrincipal) ProtoMessage() {} -func (*MSPPrincipal) Descriptor() ([]byte, []int) { return fileDescriptor4, []int{0} } +func (*MSPPrincipal) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{0} } // OrganizationUnit governs the organization of the Principal // field of a policy principal when a specific organization unity members @@ -123,7 +123,7 @@ type OrganizationUnit struct { func (m *OrganizationUnit) Reset() { *m = OrganizationUnit{} } func (m *OrganizationUnit) String() string { return proto.CompactTextString(m) } func (*OrganizationUnit) ProtoMessage() {} -func (*OrganizationUnit) Descriptor() ([]byte, []int) { return fileDescriptor4, []int{1} } +func (*OrganizationUnit) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{1} } // MSPRole governs the organization of the Principal // field of an MSPPrincipal when it aims to define one of the @@ -140,7 +140,7 @@ type MSPRole struct { func (m *MSPRole) Reset() { *m = MSPRole{} } func (m *MSPRole) String() string { return proto.CompactTextString(m) } func (*MSPRole) ProtoMessage() {} -func (*MSPRole) Descriptor() ([]byte, []int) { return fileDescriptor4, []int{2} } +func (*MSPRole) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{2} } func init() { proto.RegisterType((*MSPPrincipal)(nil), "common.MSPPrincipal") @@ -150,32 +150,32 @@ func init() { proto.RegisterEnum("common.MSPRole_MSPRoleType", MSPRole_MSPRoleType_name, MSPRole_MSPRoleType_value) } -func init() { proto.RegisterFile("common/msp_principal.proto", fileDescriptor4) } - -var fileDescriptor4 = []byte{ - // 374 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x8c, 0x92, 0xd1, 0x8e, 0x9a, 0x40, - 0x14, 0x86, 0x1d, 0x6b, 0xad, 0x9e, 0x5a, 0x42, 0x27, 0x35, 0x35, 0xad, 0x69, 0x0c, 0x6d, 0x13, - 0x93, 0xa6, 0x90, 0xe8, 0x03, 0x34, 0x5a, 0x49, 0x43, 0x52, 0xc0, 0x8c, 0x78, 0x51, 0x2f, 0x4a, - 0x10, 0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0x13, 0x2f, 0xe0, 0x0b, 0xaf, 0xa1, 0x41, - 0xe4, 0x9f, 0x12, 0x96, 0xd7, 0xb1, 0xa6, 0xc4, 0x86, 0xb7, 0xae, 0x62, 0x44, 0x2d, 0x65, 0x0a, - 0xfd, 0x90, 0x8a, 0xb2, 0xc8, 0xea, 0xf0, 0x2b, 0x79, 0xec, 0x87, 0xab, 0x78, 0x85, 0xb4, 0x7b, - 0x04, 0x6f, 0xec, 0xd5, 0x92, 0xf0, 0x88, 0xbe, 0x74, 0x5b, 0x03, 0x5a, 0x82, 0x47, 0x54, 0xee, - 0xa4, 0x4c, 0x3e, 0xd7, 0x3e, 0x4a, 0x91, 0x72, 0x79, 0x7a, 0xe7, 0x94, 0x12, 0x69, 0xd4, 0xbe, - 0xc1, 0xdb, 0x5a, 0x13, 0x03, 0xb4, 0x6d, 0xd3, 0x9e, 0x9b, 0x44, 0x6d, 0xe0, 0x2e, 0xbc, 0x9e, - 0x2d, 0x6c, 0xcb, 0x51, 0xd1, 0xfc, 0xe7, 0xe6, 0xc7, 0x81, 0xe5, 0xc7, 0xd3, 0xb6, 0x08, 0x34, - 0x8e, 0xe7, 0x94, 0x8a, 0x88, 0xee, 0x0e, 0x54, 0x18, 0xfb, 0x60, 0x2b, 0x58, 0x68, 0xc8, 0xff, - 0x27, 0x33, 0xca, 0x71, 0xdb, 0xb6, 0x2c, 0xa7, 0x4f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x72, 0xfb, - 0xc6, 0xb5, 0x6c, 0x02, 0x00, 0x00, +func init() { proto.RegisterFile("msp/msp_principal.proto", fileDescriptor1) } + +var fileDescriptor1 = []byte{ + // 372 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x8c, 0x92, 0xc1, 0xce, 0x9a, 0x40, + 0x14, 0x85, 0x1d, 0x6b, 0xad, 0xde, 0x5a, 0x42, 0x27, 0x35, 0x9a, 0xd4, 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0xf8, 0x33, 0x68, 0xe5, 0x19, 0xb0, 0x3d, 0xcd, 0x0a, 0x76, 0x60, 0x54, 0xaa, + 0x49, 0xba, 0xe4, 0x4d, 0x9a, 0x0b, 0xa7, 0x2a, 0xe2, 0x25, 0x7c, 0xe0, 0x35, 0x34, 0x4a, 0xc2, + 0x73, 0xc6, 0x8a, 0x3a, 0xd6, 0x54, 0xd8, 0xe8, 0xd1, 0x55, 0xfe, 0xa2, 0x96, 0x32, 0x83, 0x7e, + 0x4c, 0xe5, 0xf5, 0x23, 0xaf, 0xc3, 0x2f, 0xd4, 0xb0, 0xef, 0xee, 0xe2, 0x1d, 0x32, 0xfe, 0x20, + 0x78, 0xe5, 0xae, 0x57, 0x84, 0x27, 0xf4, 0xb9, 0xdd, 0x5a, 0xd0, 0x92, 0x3c, 0xa1, 0xaa, 0x27, + 0x6d, 0xfa, 0xbe, 0x76, 0x29, 0x65, 0xca, 0xed, 0x19, 0x5c, 0x04, 0x25, 0xca, 0x68, 0x7c, 0x82, + 0xd7, 0xb5, 0x22, 0x06, 0x68, 0xbb, 0xb6, 0xbb, 0xb0, 0x89, 0xde, 0xc0, 0x5d, 0x78, 0x39, 0x5f, + 0xba, 0x8e, 0xa7, 0xa3, 0xc5, 0x97, 0xed, 0xe4, 0xc8, 0x8a, 0xd3, 0x79, 0x57, 0x06, 0x5a, 0xa7, + 0x8b, 0xa0, 0x32, 0xa1, 0xfb, 0x23, 0x95, 0xd6, 0x21, 0xda, 0x49, 0x16, 0x5b, 0x6a, 0x7f, 0xf2, + 0x72, 0xa9, 0x76, 0x6d, 0xf5, 0x3e, 0xfb, 0x1f, 0x00, 0x00, 0xff, 0xff, 0x80, 0x80, 0x30, 0x7e, + 0x66, 0x02, 0x00, 0x00, } diff --git a/protos/common/msp_principal.proto b/protos/msp/msp_principal.proto similarity index 98% rename from protos/common/msp_principal.proto rename to protos/msp/msp_principal.proto index 7e112a61cc7..663966665ea 100644 --- a/protos/common/msp_principal.proto +++ b/protos/msp/msp_principal.proto @@ -17,7 +17,7 @@ limitations under the License. syntax = "proto3"; -option go_package = "github.com/hyperledger/fabric/protos/common"; +option go_package = "github.com/hyperledger/fabric/protos/msp"; package common; diff --git a/protos/msp/mspconfig.pb.go b/protos/msp/mspconfig.pb.go index 89c47c31edc..ca07658351b 100644 --- a/protos/msp/mspconfig.pb.go +++ b/protos/msp/mspconfig.pb.go @@ -27,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 fileDescriptor1, []int{0} } +func (*MSPConfig) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{0} } // FabricMSPConfig collects all the configuration information for // a Fabric MSP. @@ -74,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 fileDescriptor1, []int{1} } +func (*FabricMSPConfig) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{1} } func (m *FabricMSPConfig) GetSigningIdentity() *SigningIdentityInfo { if m != nil { @@ -106,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 fileDescriptor1, []int{2} } +func (*SigningIdentityInfo) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{2} } func (m *SigningIdentityInfo) GetPrivateSigner() *KeyInfo { if m != nil { @@ -132,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 fileDescriptor1, []int{3} } +func (*KeyInfo) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{3} } // FabricOUIdentifier represents an organizazional unit and // its related chain of trust identifier. @@ -148,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 fileDescriptor1, []int{4} } +func (*FabricOUIdentifier) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{4} } func init() { proto.RegisterType((*MSPConfig)(nil), "msp.MSPConfig") @@ -158,9 +158,9 @@ func init() { proto.RegisterType((*FabricOUIdentifier)(nil), "msp.FabricOUIdentifier") } -func init() { proto.RegisterFile("msp/mspconfig.proto", fileDescriptor1) } +func init() { proto.RegisterFile("msp/mspconfig.proto", fileDescriptor2) } -var fileDescriptor1 = []byte{ +var fileDescriptor2 = []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,