fabricca配置文件详细说明(fabric-ca设置账户使用期限)

技术Fabric CA创建用户机制的示例分析这篇文章给大家分享的是有关Fabric CA创建用户机制的示例分析的内容。小编觉得挺实用的,因此分享给大家做个参考,一起跟随小编过来看看吧。在研究Fabric CA 创建用户,

这篇文章给大家分享的是有关织物加拿大创建用户机制的示例分析的内容。小编觉得挺实用的,因此分享给大家做个参考,一起跟随小编过来看看吧。

在研究织物加拿大创建用户,的时候发现很多隐含规则

通过官方文档,我们知道织物-加州可以带有如下几个以高频。开头的属性,我们暂且称之为系统属性

名称类型描述高频。注册者。角色注册者被允许管理的角色列表。注册服务商。授权角色注册服务商被允许为其“高频”向注册服务商授予的角色列表。注册服务商。角色属性hf .注册器。属性注册器允许注册的属性列表。如果属性值为GenCRLBooleanIdentity能够生成CRL .如果属性值为truehf,RevokerBooleanIdentity可以吊销用户和/或证书。如果属性值为truehf,则attributemgrborboidentity能够管理附属关系。如果属性值为

现象一:Boolean类型系统属性

,则中间加拿大身份可以注册为中间加拿大首先,我们用管理创建账户测试_a,

Fabric  CA创建用户机制的示例分析

命令如下:

fabric-ca-clientregister-d\

- id.nametest_a\

- id.secrettest_a_pw\

- id.typeclient\

- id.affiliationeasypay.fabric\

- id.attrs''hf .注册者。角色=客户端,用户' ' \

- id.attrs''hf .注册商。代理角色=客户端,用户' ' \

- id.attrs''hf .注册器。属性=* ' \

- id.attrshf.Revoker=true\

身份证。阿特SHF。affilatemgr=真\

身份证。阿特瑟夫。intermediateca=真\

身份证。attr SF。GenCrl=假即,设置测试_a用户高频GenCRL=假,结果如下:

Fabric  CA创建用户机制的示例分析

然后我们尝试用测试_a账户分别创建以下几个账户(注意是用测试_a账户,而不是管理账户)

测试_a_a,设置测试a a用户高频。情报

CRL=true:

fabric-ca-client register -d \
--id.name test_a_a \
--id.secret test_a_a_pw \
--id.type client \
--id.affiliation easypay.fabric \
--id.attrs '"hf.Registrar.Roles=client,user"' \
--id.attrs '"hf.Registrar.DelegateRoles=client,user"' \
--id.attrs '"hf.Registrar.Attributes=*"' \
--id.attrs hf.Revoker=true \
--id.attrs hf.AffiliationMgr=true \
--id.attrs hf.IntermediateCA=true \
--id.attrs hf.GenCRL=true

结果创建失败,会报权限错误,如下所示:

Fabric CA创建用户机制的示例分析

  • test_a_b,设置test_a_b用户hf.GenCRL=false:

fabric-ca-client register -d \
--id.name test_a_b \
--id.secret test_a_b_pw \
--id.type client \
--id.affiliation easypay.fabric \
--id.attrs '"hf.Registrar.Roles=client,user"' \
--id.attrs '"hf.Registrar.DelegateRoles=client,user"' \
--id.attrs '"hf.Registrar.Attributes=*"' \
--id.attrs hf.Revoker=true \
--id.attrs hf.AffiliationMgr=true \
--id.attrs hf.IntermediateCA=true \
--id.attrs hf.GenCRL=false

结果同上:

Fabric CA创建用户机制的示例分析

  • test_a_c,不设置test_a_c用户hf.GenCRL属性:

fabric-ca-client register -d \
--id.name test_a_c \
--id.secret test_a_c_pw \
--id.type client \
--id.affiliation easypay.fabric \
--id.attrs '"hf.Registrar.Roles=client,user"' \
--id.attrs '"hf.Registrar.DelegateRoles=client,user"' \
--id.attrs '"hf.Registrar.Attributes=*"' \
--id.attrs hf.Revoker=true \
--id.attrs hf.AffiliationMgr=true \
--id.attrs hf.IntermediateCA=true

结果创建成功,如下:

Fabric CA创建用户机制的示例分析

其他几个布尔类型属性,hf.Revoker,hf.AffiliationMgr,hf.IntermediateCA,都有类似现象,即,上级id这些布尔属性如果设置为false(或者不设置),则所创建是下级id都不能带有对应的这个几个布尔类型的系统属性

现象二:hf.Registrar.Roles的约束

刚才创建的test_a身份,id.type=client ,hf.Registrar.Roles=client,user, 如果我们用test_a注册一个id.type=peer或者id.type=orderer的身份 结果会怎样呢?大家应该都想得到,肯定是失败,这里我就不做测试了

备注:fabric-ca 1.1 版本 hf.Registrar.Roles 属性只支持client,user,peer,orderer四种,1.2版本即将支持自定义角色,详见:https://jira.hyperledger.org/browse/FAB-7882

相关资料截图:

Fabric CA创建用户机制的示例分析

Fabric CA创建用户机制的示例分析

Fabric CA创建用户机制的示例分析

Fabric CA创建用户机制的示例分析

Fabric CA创建用户机制的示例分析

用 test_a 用户创建一个 test_a_d身份,设置test_a_d属性hf.Registrar.Roles=client,user,peer ,如下:

fabric-ca-client register -d \
--id.name test_a_d \
--id.secret test_a_d_pw \
--id.type client \
--id.affiliation easypay.fabric \
--id.attrs '"hf.Registrar.Roles=client,user,peer"' \
--id.attrs '"hf.Registrar.DelegateRoles=client,user,peer"' \
--id.attrs '"hf.Registrar.Attributes=*"' \
--id.attrs hf.Revoker=true \
--id.attrs hf.AffiliationMgr=true \
--id.attrs hf.IntermediateCA=true

结果创建失败,如下:

Fabric CA创建用户机制的示例分析

可以继续往下测试,可以发现,当test_a身份的属性hf.Registrar.Roles=client,user ,往下用test_a身份创建的子身份的f.Registrar.Roles属性值都不能超过client,user的范围

再用 test_a 用户创建一个 test_a_e身份,设置test_a_e 属性id.type=peer ,如下:

fabric-ca-client register -d \
--id.name test_a_e \
--id.secret test_a_e_pw \
--id.type peer \
--id.affiliation easypay.fabric \
--id.attrs '"hf.Registrar.Roles=client,user"' \
--id.attrs '"hf.Registrar.DelegateRoles=client,user"' \
--id.attrs '"hf.Registrar.Attributes=*"' \
--id.attrs hf.Revoker=true \
--id.attrs hf.AffiliationMgr=true \
--id.attrs hf.IntermediateCA=true

结果创建失败,错误信息如下:

Fabric CA创建用户机制的示例分析

子 id 的id.type属性值也受到上级id的hf.Registrar.Roles属性值的约束

现象三:hf.Registrar.Attributes 属性的约束

尝试用 admin 身份 创建 test_b ,添加hf.key=value

fabric-ca-client register -d \
--id.name test_b \
--id.secret test_b_pw \
--id.type client \
--id.attrs hf.key=value

即使admin身份hf.Registrar.Attributes=*,还是创建失败,结果如图

Fabric CA创建用户机制的示例分析

再尝试用 admin 身份 创建 test_c,添加hf=value

fabric-ca-client register -d \
--id.name test_c \
--id.secret test_c_pw \
--id.type client \
--id.attrs hf=value

创建成功,结果如图

Fabric CA创建用户机制的示例分析

总结下来,有以下几点规律:

  1. 上级id的hf.Registrar.Attributes值可以约束它所创建的子级id能添加的属性,但是带hf.的除外,带hf.开头的会被当做系统属性,区别对待

  2. 从上级往下,所带的属性约束只能是逐渐收敛的,不能发散

相关代码

感兴趣可以详细研究一下源代码 相关部分代码可以参见:https://github.com/hyperledger/fabric-ca/blob/release-1.1/lib/attr/attribute.go

Fabric CA创建用户机制的示例分析 Fabric CA创建用户机制的示例分析

感谢各位的阅读!关于“Fabric CA创建用户机制的示例分析”这篇文章就分享到这里了,希望

内容来源网络,如有侵权,联系删除,本文地址:https://www.230890.com/zhan/158391.html

(0)

相关推荐

  • 微信小程序swiper组件怎么创建(微信小程序的wxss文件作用)

    技术微信小程序中的wxs模块怎么用这篇文章将为大家详细讲解有关微信小程序中的wxs模块怎么用,小编觉得挺实用的,因此分享给大家做个参考,希望大家阅读完这篇文章后可以有所收获。WXS的使用wxs是专门用于wxml页面的,它

    攻略 2021年12月19日
  • Bytom中Dapp Demo合同交易的提交方式是什么?

    技术Bytom中Dapp Demo合约交易的提交方法是什么这篇文章主要讲解了“Bytom中Dapp Demo合约交易的提交方法是什么”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究

    攻略 2021年12月20日
  • 生成器与常见内置函数

    技术生成器与常见内置函数 生成器与常见内置函数异常捕获补充
    # 异常捕获的完整形式
    try:name
    except NameError as e:pass
    except Exception as e:p

    礼包 2021年11月23日
  • 大头菜的腌制方法,大头菜怎么腌制脆爽好吃

    技术大头菜的腌制方法,大头菜怎么腌制脆爽好吃大头菜,其实就是“甘蓝”,也叫圆白菜,我看好多朋友都分辨不出什么是大头菜大头菜的腌制方法?在我们北方地区,通常会将“甘蓝”称作大头菜,这只是一种当地的叫法,因为甘蓝的形状很圆,

    生活 2021年10月23日
  • 西欧有哪些国家,欧洲有哪些国家

    技术西欧有哪些国家,欧洲有哪些国家欧洲不包括美国。欧洲共有44个国家和地区西欧有哪些国家,在地理上被习惯分为北欧、东欧、南欧、中欧、西欧五个地区。 1、北欧:芬兰、瑞典、挪威、冰岛、丹麦 、法罗群岛 ; 2、东欧:爱沙尼

    2021年10月23日
  • JS页面模板化有哪些

    技术JS页面模板化有哪些这篇文章主要介绍“JS页面模板化有哪些”,在日常操作中,相信很多人在JS页面模板化有哪些问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答”JS页面模板化有哪些”的疑惑有

    攻略 2021年11月18日