1 Star 3 Fork 2

Hyperledger Fabric 国密/fabric-ca

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
cri.go 1002 Bytes
一键复制 编辑 原始数据 按行查看 历史
Jtyoui 提交于 2021-07-22 18:25 . fabric-ca改造
/*
Copyright IBM Corp. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package idemix
import (
proto "github.com/golang/protobuf/proto"
"gitee.com/hyperledger-fabric-gm/fabric-ca/api"
"gitee.com/hyperledger-fabric-gm/fabric-ca/util"
"github.com/pkg/errors"
)
// CRIRequestHandler is the handler for Idemix CRI (credential revocation information) request
type CRIRequestHandler struct {
Ctx ServerRequestCtx
Issuer MyIssuer
}
// HandleRequest handles processing for idemix/cri request
func (ch *CRIRequestHandler) HandleRequest() (*api.GetCRIResponse, error) {
_, err := ch.Ctx.TokenAuthentication()
if err != nil {
return nil, err
}
cri, err := ch.Issuer.RevocationAuthority().CreateCRI()
if err != nil {
return nil, err
}
criBytes, err := proto.Marshal(cri)
if err != nil {
return nil, errors.New("Failed to marshal Idemix credential to bytes")
}
b64CriBytes := util.B64Encode(criBytes)
res := api.GetCRIResponse{
CRI: b64CriBytes,
}
return &res, nil
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/hyperledger-fabric-gm/fabric-ca.git
git@gitee.com:hyperledger-fabric-gm/fabric-ca.git
hyperledger-fabric-gm
fabric-ca
fabric-ca
ffb137a43593

搜索帮助