Skip to content

Commit daa0de5

Browse files
author
Manu Drijvers
committed
[FAB-5673] Adds idemix-based MSP implementation
This commit adds an MSP implementation based on identity mixer, allowing anonymous signing of transactions. Change-Id: If13221756a019b5a4214ea1b2f06545600082427 Signed-off-by: Manu Drijvers <mdr@zurich.ibm.com> Signed-off-by: Maria Dubovitskaya <mdu@zurich.ibm.com>
1 parent 72f6670 commit daa0de5

File tree

17 files changed

+1372
-101
lines changed

17 files changed

+1372
-101
lines changed

msp/configbuilder.go

Lines changed: 28 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,23 @@
11
/*
2-
Copyright IBM Corp. 2017 All Rights Reserved.
2+
Copyright IBM Corp. All Rights Reserved.
33
4-
Licensed under the Apache License, Version 2.0 (the "License");
5-
you may not use this file except in compliance with the License.
6-
You may obtain a copy of the License at
7-
8-
http://www.apache.org/licenses/LICENSE-2.0
9-
10-
Unless required by applicable law or agreed to in writing, software
11-
distributed under the License is distributed on an "AS IS" BASIS,
12-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
See the License for the specific language governing permissions and
14-
limitations under the License.
4+
SPDX-License-Identifier: Apache-2.0
155
*/
166

177
package msp
188

199
import (
10+
"encoding/pem"
2011
"fmt"
2112
"io/ioutil"
22-
23-
"github.com/golang/protobuf/proto"
24-
25-
"encoding/pem"
26-
"path/filepath"
27-
2813
"os"
14+
"path/filepath"
2915

16+
"github.com/golang/protobuf/proto"
3017
"github.com/hyperledger/fabric/bccsp"
3118
"github.com/hyperledger/fabric/bccsp/factory"
3219
"github.com/hyperledger/fabric/protos/msp"
20+
"github.com/pkg/errors"
3321
"gopkg.in/yaml.v2"
3422
)
3523

@@ -276,3 +264,25 @@ func getMspConfig(dir string, ID string, sigid *msp.SigningIdentityInfo) (*msp.M
276264

277265
return mspconf, nil
278266
}
267+
268+
// IdemixConfig is the filename of the idemix msp config file
269+
const IdemixConfig = "idemixmspconfig"
270+
271+
// GetIdemixMspConfig returns the configuration for the Idemix MSP
272+
func GetIdemixMspConfig(dir string) (*msp.MSPConfig, error) {
273+
confStringBytes, err := readFile(filepath.Join(dir, IdemixConfig))
274+
if err != nil {
275+
return nil, errors.Wrapf(err, "error reading idemix config file")
276+
}
277+
config := &msp.IdemixMSPConfig{}
278+
err = proto.UnmarshalText(string(confStringBytes), config)
279+
if err != nil {
280+
return nil, errors.Wrapf(err, "error unmarshalling idemix config")
281+
}
282+
confBytes, err := proto.Marshal(config)
283+
if err != nil {
284+
return nil, errors.Wrapf(err, "error creating idemix config")
285+
}
286+
287+
return &msp.MSPConfig{Config: confBytes, Type: int32(IDEMIX)}, nil
288+
}

0 commit comments

Comments
 (0)