Skip to content

hututu578/bswabe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

bswabe absract

BSW-ABE base on c++, pbc lib. 具体实现原理及详细步骤可参考:https://blog.csdn.net/weixin_42700740/article/details/142654384?spm=1001.2014.3001.5501

1.依赖

    依赖pbc,gmp,crypto库,需要安装PBC,Openssl库。

2.编译

g++ main.cpp bswabe.cpp -o test -L/usr/local/lib/pbc -lpbc -L/usr/lib -lgmp -lcrypto

3.运行

./test

4.运行结果

********************************************step1:系统初始化阶段***************************************************

********************************************step2:密钥生成阶段***************************************************

********************************************step3:加密阶段***************************************************
Plaintext M_string: cc11111111112222222222333333333344444444445555555555666666666677777777778aabbbbbbbbbbccccccccccddddddddddeeeeeeeeee33, size = 117
Plaintext M: [5205344140073205636919547778842138865494575854406214706964728954569561463991554903588844784666170336947548779351242192082515106137749581432358453376333623, 2891880141752324864617312240915208141818104769656821415680416289610269083212830577235247828579371943992052019821671556566345604006848332756293850792722432]
cs (Encrypted message): [5916257443095765904788063490198978673229284956809812978643773997849045665217377660331616477039520327887401648265640222836172921996693726580892896772089104, 6580301541418529665227073754685731831520714940276594480419975985410534354665198204672431446692765829662886361273113823877735711245227723200574325896138232]
Access policy tree:
Node: k = 2, attr = 
  Node: k = 1, attr = 
    Node: k = 1, attr = attr1
    Node: k = 2, attr = 
      Node: k = 1, attr = attr2
      Node: k = 1, attr = 
        Node: k = 1, attr = attr3
        Node: k = 1, attr = attr4
  Node: k = 1, attr = 
    Node: k = 1, attr = attr5
    Node: k = 2, attr = 
      Node: k = 1, attr = attr6
      Node: k = 1, attr = 
        Node: k = 1, attr = attr7
        Node: k = 1, attr = attr8

********************************************step4:解密阶段***************************************************
Decrypt success! Decrypted plaintext is: cc11111111112222222222333333333344444444445555555555666666666677777777778aabbbbbbbbbbccccccccccddddddddddeeeeeeeeee33,size= 117

5.dem中策略树结构

                             AND (2of2)
                            /           \
                     OR (1of2)         OR (1of2)
                    /         \       /         \
               attr1       AND (2of2)  attr5   AND (2of2)
                             /    \               /    \
                         attr2  OR (1of2)     attr6  OR (1of2)
                                   /    \             /    \
                               attr3 attr4        attr7 attr8

About

BSW-ABE base on c++, pbc lib

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages