Skip to content

Commit

Permalink
[FAB-5673] Adds idemix-based MSP implementation
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Manu Drijvers committed Sep 6, 2017
1 parent 72f6670 commit daa0de5
Show file tree
Hide file tree
Showing 17 changed files with 1,372 additions and 101 deletions.
46 changes: 28 additions & 18 deletions msp/configbuilder.go
Original file line number Diff line number Diff line change
@@ -1,35 +1,23 @@
/*
Copyright IBM Corp. 2017 All Rights Reserved.
Copyright IBM Corp. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
SPDX-License-Identifier: Apache-2.0
*/

package msp

import (
"encoding/pem"
"fmt"
"io/ioutil"

"github.com/golang/protobuf/proto"

"encoding/pem"
"path/filepath"

"os"
"path/filepath"

"github.com/golang/protobuf/proto"
"github.com/hyperledger/fabric/bccsp"
"github.com/hyperledger/fabric/bccsp/factory"
"github.com/hyperledger/fabric/protos/msp"
"github.com/pkg/errors"
"gopkg.in/yaml.v2"
)

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

return mspconf, nil
}

// IdemixConfig is the filename of the idemix msp config file
const IdemixConfig = "idemixmspconfig"

// GetIdemixMspConfig returns the configuration for the Idemix MSP
func GetIdemixMspConfig(dir string) (*msp.MSPConfig, error) {
confStringBytes, err := readFile(filepath.Join(dir, IdemixConfig))
if err != nil {
return nil, errors.Wrapf(err, "error reading idemix config file")
}
config := &msp.IdemixMSPConfig{}
err = proto.UnmarshalText(string(confStringBytes), config)
if err != nil {
return nil, errors.Wrapf(err, "error unmarshalling idemix config")
}
confBytes, err := proto.Marshal(config)
if err != nil {
return nil, errors.Wrapf(err, "error creating idemix config")
}

return &msp.MSPConfig{Config: confBytes, Type: int32(IDEMIX)}, nil
}
Loading

0 comments on commit daa0de5

Please sign in to comment.