@@ -108,19 +108,41 @@ func SetupBCCSPKeystoreConfig(bccspConfig *factory.FactoryOpts, keystoreDir stri
108
108
}
109
109
110
110
func GetLocalMspConfig (dir string , bccspConfig * factory.FactoryOpts , ID string ) (* msp.MSPConfig , error ) {
111
- cacertDir := filepath .Join (dir , cacerts )
112
111
signcertDir := filepath .Join (dir , signcerts )
113
- admincertDir := filepath .Join (dir , admincerts )
114
112
keystoreDir := filepath .Join (dir , keystore )
115
- intermediatecertsDir := filepath .Join (dir , intermediatecerts )
116
-
117
113
SetupBCCSPKeystoreConfig (bccspConfig , keystoreDir )
118
114
119
115
err := factory .InitFactories (bccspConfig )
120
116
if err != nil {
121
117
return nil , fmt .Errorf ("Could not initialize BCCSP Factories [%s]" , err )
122
118
}
123
119
120
+ signcert , err := getPemMaterialFromDir (signcertDir )
121
+ if err != nil || len (signcert ) == 0 {
122
+ return nil , fmt .Errorf ("Could not load a valid signer certificate from directory %s, err %s" , signcertDir , err )
123
+ }
124
+
125
+ /* FIXME: for now we're making the following assumptions
126
+ 1) there is exactly one signing cert
127
+ 2) BCCSP's KeyStore has the the private key that matches SKI of
128
+ signing cert
129
+ */
130
+
131
+ sigid := & msp.SigningIdentityInfo {PublicSigner : signcert [0 ], PrivateSigner : nil }
132
+
133
+ return getMspConfig (dir , bccspConfig , ID , sigid )
134
+ }
135
+
136
+ func GetVerifyingMspConfig (dir string , bccspConfig * factory.FactoryOpts , ID string ) (* msp.MSPConfig , error ) {
137
+ return getMspConfig (dir , bccspConfig , ID , nil )
138
+ }
139
+
140
+ func getMspConfig (dir string , bccspConfig * factory.FactoryOpts , ID string , sigid * msp.SigningIdentityInfo ) (* msp.MSPConfig , error ) {
141
+ cacertDir := filepath .Join (dir , cacerts )
142
+ signcertDir := filepath .Join (dir , signcerts )
143
+ admincertDir := filepath .Join (dir , admincerts )
144
+ intermediatecertsDir := filepath .Join (dir , intermediatecerts )
145
+
124
146
cacerts , err := getPemMaterialFromDir (cacertDir )
125
147
if err != nil || len (cacerts ) == 0 {
126
148
return nil , fmt .Errorf ("Could not load a valid ca certificate from directory %s, err %s" , cacertDir , err )
@@ -139,14 +161,6 @@ func GetLocalMspConfig(dir string, bccspConfig *factory.FactoryOpts, ID string)
139
161
intermediatecert , _ := getPemMaterialFromDir (intermediatecertsDir )
140
162
// intermediate certs are not mandatory
141
163
142
- /* FIXME: for now we're making the following assumptions
143
- 1) there is exactly one signing cert
144
- 2) BCCSP's KeyStore has the the private key that matches SKI of
145
- signing cert
146
- */
147
-
148
- sigid := & msp.SigningIdentityInfo {PublicSigner : signcert [0 ], PrivateSigner : nil }
149
-
150
164
fmspconf := & msp.FabricMSPConfig {
151
165
Admins : admincert ,
152
166
RootCerts : cacerts ,
0 commit comments