Skip to content

Commit a8a77b1

Browse files
adecarobestbeforetoday
authored andcommitted
Idemix MSP structure incompatible with Fabric
This change changes the Idemix MSP folder structure to match the structure expected by Fabric. It replicates the changes previously delivered (and subsequently reverted) in the following commits: - acea746 - 29e083e - 0fcf897 - dfd29fe - 77c54da Signed-off-by: Mark S. Lewis <Mark.S.Lewis@outlook.com> Co-authored-by: Angelo De Caro <adc@zurich.ibm.com>
1 parent a82dbca commit a8a77b1

24 files changed

Lines changed: 2437 additions & 118 deletions

File tree

api/serverresponses.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ type CAInfoResponseNet struct {
2020
// Base64 encoding of Idemix issuer public key
2121
IssuerPublicKey string
2222
// Base64 encoding of PEM-encoded Idemix issuer revocation public key
23-
IssuerRevocationPublicKey string
23+
RevocationPublicKey string
2424
// Version of the server
2525
Version string
2626
}

cmd/fabric-ca-client/command/enroll.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,5 +88,5 @@ func (c *enrollCmd) runEnroll(cmd *cobra.Command, args []string) error {
8888
if err != nil {
8989
return err
9090
}
91-
return storeIssuerRevocationPublicKey(cfg, &resp.CAInfo)
91+
return storeRevocationPublicKey(cfg, &resp.CAInfo)
9292
}

cmd/fabric-ca-client/command/getcainfo.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ func (c *getCAInfoCmd) runGetCACert(cmd *cobra.Command, args []string) error {
102102
if err != nil {
103103
return err
104104
}
105-
return storeIssuerRevocationPublicKey(client.Config, si)
105+
return storeRevocationPublicKey(client.Config, si)
106106
}
107107

108108
// Store the CAChain in the CACerts folder of MSP (Membership Service Provider)
@@ -200,9 +200,9 @@ func storeIssuerPublicKey(config *lib.ClientConfig, si *lib.GetCAInfoResponse) e
200200
return nil
201201
}
202202

203-
func storeIssuerRevocationPublicKey(config *lib.ClientConfig, si *lib.GetCAInfoResponse) error {
204-
if len(si.IssuerRevocationPublicKey) > 0 {
205-
err := storeToFile("Issuer revocation public key", config.MSPDir, "IssuerRevocationPublicKey", si.IssuerRevocationPublicKey)
203+
func storeRevocationPublicKey(config *lib.ClientConfig, si *lib.GetCAInfoResponse) error {
204+
if len(si.RevocationPublicKey) > 0 {
205+
err := storeToFile("Issuer revocation public key", config.MSPDir, "RevocationPublicKey", si.RevocationPublicKey)
206206
if err != nil {
207207
return err
208208
}

cmd/fabric-ca-client/command/main_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2188,7 +2188,7 @@ func TestCleanUp(t *testing.T) {
21882188
os.Remove(filepath.Join(tdDir, "ca-key.pem"))
21892189
os.Remove(filepath.Join(tdDir, "IssuerPublicKey"))
21902190
os.Remove(filepath.Join(tdDir, "IssuerSecretKey"))
2191-
os.Remove(filepath.Join(tdDir, "IssuerRevocationPublicKey"))
2191+
os.Remove(filepath.Join(tdDir, "RevocationPublicKey"))
21922192
os.Remove(testYaml)
21932193
os.Remove(fabricCADB)
21942194
os.RemoveAll(moptionDir)
@@ -2199,7 +2199,7 @@ func cleanMultiCADir() {
21992199
caFolder := filepath.Join(tdDir, "ca/rootca")
22002200
nestedFolders := []string{"ca1", "ca2"}
22012201
removeFiles := []string{"msp", "ca-cert.pem",
2202-
"fabric-ca-server.db", "fabric-ca2-server.db", "ca-chain.pem", "IssuerPublicKey", "IssuerSecretKey", "IssuerRevocationPublicKey"}
2202+
"fabric-ca-server.db", "fabric-ca2-server.db", "ca-chain.pem", "IssuerPublicKey", "IssuerSecretKey", "RevocationPublicKey"}
22032203

22042204
for _, nestedFolder := range nestedFolders {
22052205
path := filepath.Join(caFolder, nestedFolder)

cmd/fabric-ca-server/main_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ func TestClean(t *testing.T) {
434434
os.Remove("ca-cert.pem")
435435
os.Remove("IssuerSecretKey")
436436
os.Remove("IssuerPublicKey")
437-
os.Remove("IssuerRevocationPublicKey")
437+
os.Remove("RevocationPublicKey")
438438
os.Remove("fabric-ca-server.db")
439439
os.RemoveAll("keystore")
440440
os.RemoveAll("msp")
@@ -443,7 +443,7 @@ func TestClean(t *testing.T) {
443443
os.Remove("../../testdata/ca-cert.pem")
444444
os.Remove("../../testdata/IssuerSecretKey")
445445
os.Remove("../../testdata/IssuerPublicKey")
446-
os.Remove("../../testdata/IssuerRevocationPublicKey")
446+
os.Remove("../../testdata/RevocationPublicKey")
447447
os.RemoveAll(ldapTestDir)
448448
os.RemoveAll("testregattr")
449449
}
@@ -452,7 +452,7 @@ func cleanUpMultiCAFiles() {
452452
caFolder := "../../testdata/ca/rootca"
453453
nestedFolders := []string{"ca1", "ca2"}
454454
removeFiles := []string{"msp", "ca-cert.pem", "ca-key.pem", "fabric-ca-server.db",
455-
"fabric-ca2-server.db", "IssuerSecretKey", "IssuerPublicKey", "IssuerRevocationPublicKey"}
455+
"fabric-ca2-server.db", "IssuerSecretKey", "IssuerPublicKey", "RevocationPublicKey"}
456456

457457
for _, nestedFolder := range nestedFolders {
458458
path := filepath.Join(caFolder, nestedFolder)

docs/source/deployguide/cadeploy.md

Lines changed: 48 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,10 @@ Because you will use a single CA client to submit register and enrollment reques
3939

4040
```
4141
fabric-ca-client
42-
├── int-ca
43-
├── org1-ca
44-
├── tls-ca
45-
└── tls-root-cert
46-
42+
├── int-ca
43+
├── org1-ca
44+
├── tls-ca
45+
└── tls-root-cert
4746
```
4847

4948
**Important:** If your Fabric CA client will transact with CAs from multiple organizations that are secured by different TLS servers, then you would need to either create different `tls-root-cert` folders to hold the TLS CA root certificate for each organization or simply name them differently inside the folder to differentiate them. Since our Fabric CA client will only be transacting with CA servers in the same organization, all of which are secured by the same TLS CA, we will only have a single root certificate in this folder.
@@ -194,8 +193,8 @@ The folder structure that we are using for these Fabric CA client commands is:
194193

195194
```
196195
fabric-ca-client
197-
── tls-ca
198-
└── tls-root-cert
196+
── tls-ca
197+
└── tls-root-cert
199198
```
200199

201200
These folders are used by the Fabric CA client to:
@@ -293,15 +292,15 @@ The resulting folder structure resembles:
293292

294293
```
295294
fabric-ca-client
296-
└── tls-ca
297-
── tlsadmin
298-
└── msp
299-
── rcaadmin
300-
└── msp
301-
── icaadmin
302-
└── msp
295+
└── tls-ca
296+
── tlsadmin
297+
| └── msp
298+
── rcaadmin
299+
| └── msp
300+
── icaadmin
301+
| └── msp
303302
└── tls-root-cert
304-
└── tls-ca-cert.pem
303+
└── tls-ca-cert.pem
305304
```
306305

307306
**Tip:** After you have registered all your nodes with the TLS CA, it can be safely turned off.
@@ -336,19 +335,19 @@ Because you've already registered and enrolled your organization CA bootstrap id
336335

337336
```
338337
fabric-ca-client
339-
└── tls-ca
340-
── rcaadmin
341-
── msp
342-
      ├── IssuerPublicKey
343-
      ├── IssuerRevocationPublicKey
344-
      ├── cacerts
345-
   ├── keystore
346-
     └── key.pem
347-
     ├── signcerts
348-
         └── cert.pem
338+
└── tls-ca
339+
── rcaadmin
340+
── msp
341+
├── IssuerPublicKey
342+
├── RevocationPublicKey
343+
├── cacerts
344+
├── keystore
345+
  | └── key.pem
346+
── signcerts
347+
  └── cert.pem
349348
fabric-ca-server-org1
350-
└── tls
351-
── cert.pem
349+
└── tls
350+
── cert.pem
352351
└── key.pem
353352
```
354353

@@ -401,7 +400,7 @@ The folder structure we are using for these commands is:
401400

402401
```
403402
fabric-ca-client
404-
── org1-ca
403+
── org1-ca
405404
└── tls-root-cert
406405
```
407406

@@ -443,14 +442,13 @@ These folders are used by the Fabric CA client to:
443442
```
444443
└── msp
445444
├── cacerts
446-
└── my-machine-example-com-7055.pem
445+
| └── my-machine-example-com-7055.pem
447446
├── keystore
448-
└── 60b6a16b8b5ba3fc3113c522cce86a724d7eb92d6c3961cfd9afbd27bf11c37f_sk
447+
| └── 60b6a16b8b5ba3fc3113c522cce86a724d7eb92d6c3961cfd9afbd27bf11c37f_sk
449448
├── signcerts
450-
└── cert.pem
451-
├── user
449+
| └── cert.pem
452450
├── IssuerPublicKey
453-
└── IssuerRevocationPublicKey
451+
└── RevocationPublicKey
454452
```
455453

456454
Where:
@@ -504,22 +502,22 @@ The resulting folder structure is similar to the following structure. (Some fold
504502

505503
```
506504
fabric-ca-client
507-
└── tls-ca
508-
── icaadmin
509-
├── msp
510-
      ├── cacerts
511-
   ├── keystore
512-
     └── key.pem
513-
     ├── signcerts
514-
         └── cert.pem
515-
── tlscacerts
516-
├── user
517-
├── IssuerPublicKey
518-
     └── IssuerRevocationPublicKey
505+
└── tls-ca
506+
── icaadmin
507+
├── user
508+
── msp
509+
├── cacerts
510+
── keystore
511+
   | └── key.pem
512+
── signcerts
513+
|   └── cert.pem
514+
├── tlscacerts
515+
├── IssuerPublicKey
516+
└── RevocationPublicKey
519517
fabric-ca-server-int-ca
520-
└── tls
521-
── tls-ca-cert.pem
522-
── cert.pem
518+
└── tls
519+
── tls-ca-cert.pem
520+
── cert.pem
523521
└── key.pem
524522
```
525523

@@ -560,8 +558,8 @@ The folder structure we are using for these commands is
560558

561559
```
562560
fabric-ca-client
563-
── int-ca
564-
└── tls-root-cert
561+
── int-ca
562+
└── tls-root-cert
565563
```
566564

567565
These folders are used by the Fabric CA client to:

docs/source/operations_guide.rst

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -233,16 +233,16 @@ issued form the CA. You will see files such as the ones below:
233233
234234
admin
235235
├── fabric-ca-client-config.yaml
236+
├── user
236237
└── msp
237-
├── IssuerPublicKey
238-
├── IssuerRevocationPublicKey
239-
├── cacerts
240-
│ └── 0-0-0-0-7053.pem
241-
├── keystore
242-
│ └── 60b6a16b8b5ba3fc3113c522cce86a724d7eb92d6c3961cfd9afbd27bf11c37f_sk
243-
├── signcerts
244-
│ └── cert.pem
245-
└── user
238+
├── IssuerPublicKey
239+
├── RevocationPublicKey
240+
├── cacerts
241+
│ └── 0-0-0-0-7053.pem
242+
├── keystore
243+
│ └── 60b6a16b8b5ba3fc3113c522cce86a724d7eb92d6c3961cfd9afbd27bf11c37f_sk
244+
└── signcerts
245+
└── cert.pem
246246
247247
The ``fabric-ca-client-config.yaml`` is a file that is generated by the CA client,
248248
this file contains the configuration of the CA client. There are three other important files

go.mod

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ require (
2020
github.com/grantae/certinfo v0.0.0-20170412194111-59d56a35515b
2121
github.com/hyperledger/fabric-amcl v0.0.0-20230602173724-9e02669dceb2
2222
github.com/hyperledger/fabric-lib-go v1.1.2
23+
github.com/hyperledger/fabric-protos-go-apiv2 v0.3.3
2324
github.com/jinzhu/copier v0.3.5
2425
github.com/jmoiron/sqlx v1.2.0
2526
github.com/kisielk/sqlstruct v0.0.0-20201105191214-5f3e10d3ab46
@@ -37,6 +38,7 @@ require (
3738
github.com/spf13/viper v1.7.0
3839
github.com/stretchr/testify v1.11.1
3940
golang.org/x/crypto v0.45.0
41+
google.golang.org/protobuf v1.36.7
4042
gopkg.in/yaml.v2 v2.4.0
4143
)
4244

@@ -83,7 +85,6 @@ require (
8385
golang.org/x/sys v0.38.0 // indirect
8486
golang.org/x/text v0.31.0 // indirect
8587
google.golang.org/grpc v1.65.0 // indirect
86-
google.golang.org/protobuf v1.36.7 // indirect
8788
gopkg.in/ini.v1 v1.67.0 // indirect
8889
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
8990
gopkg.in/yaml.v3 v3.0.1 // indirect

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,8 @@ github.com/hyperledger/fabric-amcl v0.0.0-20230602173724-9e02669dceb2 h1:B1Nt8hK
290290
github.com/hyperledger/fabric-amcl v0.0.0-20230602173724-9e02669dceb2/go.mod h1:X+DIyUsaTmalOpmpQfIvFZjKHQedrURQ5t4YqquX7lE=
291291
github.com/hyperledger/fabric-lib-go v1.1.2 h1:3eHwudGZC5Ex7go5UAzVKhpF34gypPZGfSZksBKLWvE=
292292
github.com/hyperledger/fabric-lib-go v1.1.2/go.mod h1:SHNCq8AB0VpHAmvJEtdbzabv6NNV1F48JdmDihasBjc=
293+
github.com/hyperledger/fabric-protos-go-apiv2 v0.3.3 h1:Xpd6fzG/KjAOHJsq7EQXY2l+qi/y8muxBaY7R6QWABk=
294+
github.com/hyperledger/fabric-protos-go-apiv2 v0.3.3/go.mod h1:2pq0ui6ZWA0cC8J+eCErgnMDCS1kPOEYVY+06ZAK0qE=
293295
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
294296
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
295297
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=

lib/ca.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1013,7 +1013,7 @@ func (ca *CA) fillCAInfo(info *api.CAInfoResponseNet) error {
10131013
return err
10141014
}
10151015
info.IssuerPublicKey = util.B64Encode(ipkBytes)
1016-
info.IssuerRevocationPublicKey = util.B64Encode(rpkBytes)
1016+
info.RevocationPublicKey = util.B64Encode(rpkBytes)
10171017
return nil
10181018
}
10191019

0 commit comments

Comments
 (0)