当前位置: 首页> 健康> 美食 > 免费开网店平台有哪些_什么是网络营销宏观环境因素_网站推广技巧有哪些_市场推广专员

免费开网店平台有哪些_什么是网络营销宏观环境因素_网站推广技巧有哪些_市场推广专员

时间:2025/7/10 17:27:59来源:https://blog.csdn.net/mutourend/article/details/144157076 浏览次数:0次
免费开网店平台有哪些_什么是网络营销宏观环境因素_网站推广技巧有哪些_市场推广专员

1. 引言

使用 CP-ABE(Cipher Policy — Attributed-Based Encryption,密文策略-基于属性的加密),可以根据策略和一组属性生成加密密钥。Shashank Agrawal 和 Melissa Chase 2017年论文《FAME: Fast Attribute-based Message Encryption》(发表于 2017 ACM SIGSAC Conference)中所提出的FAME算法,就是一种CP-ABE。

FAME 使用Type-III pairing groups(如 BNS256),这是最有效的密码学配对。FAME具有以下主要特点:

  • 对策略或属性集的大小没有限制。
  • 允许将任意字符串用作属性。
  • 仅需少量的配对即可解密。
  • 在标准硬度假设下满足自然安全性要求。

通过FAME,可创建一个密文策略以及一个公钥对:

 a := abe.NewFAME ( ) 
// 密钥对
pk, sk, err := a.GenerateMasterKeys ( )

接下来,可实施策略来生成 MSP(monotone span programs,单调跨度程序):

policy:="((Edinburgh AND NHS) OR (Glasgow AND SOCIAL)) AND GOV"msp, err := abe.BooleanToMSP(policy, false)

在这种情况下,需要证明是“Edinburgh and part of the NHS”,或者“ Glasgow and part of social care (SOCIAL)”。除此之外,还需要证明“part of the government (GOV)”。然后可以使用该公钥和该策略加密一条消息 (msg):

 cipher, err := a.Encrypt(msg, msp, pk)

该密文只能使用私钥和正确的属性才能解密:

 gamma := strings.Split(attributes, " ")keys, err := a.GenerateAttribKeys(gamma, sk)msgCheck, err := a.Decrypt(cipher, keys, pk)

完整代码见https://asecuritysite.com/abe/go_abe02:

package mainimport ("fmt""os""github.com/fentec-project/gofe/abe""strings"
)func main() {policy:="((Edinburgh AND NHS) OR (Glasgow AND SOCIAL)) AND GOV"attributes:="Edinburgh NHS Glasgow GOV"msg:="Hello"argCount := len(os.Args[1:])if (argCount>0) { msg= (os.Args[1]) }if (argCount>1) { policy= (os.Args[2]) }if (argCount>2) { attributes= (os.Args[3]) }a := abe.NewFAME()// Key Pairpk, sk, err := a.GenerateMasterKeys()if err != nil {fmt.Printf("Failed to generate master keys: %v", err)}msp, err := abe.BooleanToMSP(policy, false)if err != nil {fmt.Printf("Failed to generate the policy: %v", err)}cipher, err := a.Encrypt(msg, msp, pk)if err != nil {fmt.Printf("Failed to encrypt: %v", err)}gamma := strings.Split(attributes, " ")// generate keys for decryption for an entity with attributeskeys, err := a.GenerateAttribKeys(gamma, sk)if err != nil {fmt.Printf("Failed to generate keys: %v", err)}// decrypt the ciphertextmsgRecovered, err := a.Decrypt(cipher, keys, pk)if err != nil {fmt.Printf("Failed to decrypt: %v", err)}fmt.Printf("Attributes: %v\nPolicy %v\n\n",attributes,policy)fmt.Printf("Message: %v\nRecovered %v",msg, msgRecovered)
}

对于正确的属性,有:

Attributes: Edinburgh Glasgow GOVPolicy (Edinburgh OR Glasgow) AND GOV
Message: Hello
Recovered Hello

对于不正确的属性,有:

Failed to decrypt: provided key is not sufficient for decryption
Attributes: Edinburgh Glasgow
Policy (Edinburgh OR Glasgow) AND GOV
Message: Hello
Recovered

其它示例有:

  • 消息:“Hello”。属性:[Edinburgh Glasgow GOV]。策略:(Edinburgh OR Glasgow) AND GOV。
  • 消息:“Hello”。属性:[Edinburgh Glasgow]。策略:(Edinburgh OR Glasgow) AND GOV。
  • 消息:“Hello”。属性:[Bob Production]。策略:(Bob AND Production) OR (Alice AND SALES)。
  • 消息:“Hello”。属性:[Bob SALES]。策略:(Bob AND Production) OR (Alice AND SALES)。
  • 消息:“Hello”。属性:[Alice SALES]。策略:(Bob AND Production) OR (Alice AND SALES)。

参考资料

[1] Prof Bill Buchanan OBE FRSE 2024年11月18日博客 FAME and Enhanced Attributed-Based Security

关键字:免费开网店平台有哪些_什么是网络营销宏观环境因素_网站推广技巧有哪些_市场推广专员

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

责任编辑: