bls java_Java PairingFactory.getPairing方法代碼示例

本文整理匯總了Java中it.unisa.dia.gas.plaf.jpbc.pairing.PairingFactory.getPairing方法的典型用法代碼示例。如果您正苦於以下問題:Java PairingFactory.getPairing方法的具體用法?Java PairingFactory.getPairing怎麽用?Java PairingFactory.getPairing使用的例子?那麽恭喜您, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類it.unisa.dia.gas.plaf.jpbc.pairing.PairingFactory的用法示例。

在下文中一共展示了PairingFactory.getPairing方法的16個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於我們的係統推薦出更棒的Java代碼示例。

示例1: BLSCommittedSecretShareMessage

​點讚 3

import it.unisa.dia.gas.plaf.jpbc.pairing.PairingFactory; //導入方法依賴的package包/類

private BLSCommittedSecretShareMessage(BLS01Parameters blsParameters, ASN1Sequence seq)

{

this.index = ASN1Integer.getInstance(seq.getObjectAt(0)).getValue().intValue();

this.value = ASN1Integer.getInstance(seq.getObjectAt(1)).getValue();

this.witness = ASN1Integer.getInstance(seq.getObjectAt(2)).getValue();

ASN1Sequence s = ASN1Sequence.getInstance(seq.getObjectAt(3));

this.commitmentFactors = new Element[s.size()];

for (int i = 0; i != commitmentFactors.length; i++)

{

commitmentFactors[i] = blsParameters.getG().duplicate();

commitmentFactors[i].setFromBytes(DEROctetString.getInstance(s.getObjectAt(i)).getOctets());

}

Pairing pairing = PairingFactory.getPairing(blsParameters.getCurveParameters());

this.pK = pairing.getG2().newElement();

this.pK.setFromBytes(DEROctetString.getInstance(seq.getObjectAt(4)).getOctets());

}

開發者ID:cwgit,項目名稱:ximix,代碼行數:21,

示例2: initialize

​點讚 3

import it.unisa.dia.gas.plaf.jpbc.pairing.PairingFactory; //導入方法依賴的package包/類

@Override

public void initialize() {

if (forEncryption) {

if (!(key instanceof FEEncryptionParameters))

throw new IllegalArgumentException("FEEncryptionParameters are required for encryption.");

} else {

if (!(key instanceof IPLOSTW10SecretKeyParameters))

throw new IllegalArgumentException("IPLOSTW10SecretKeyParameters are required for decryption.");

}

IPLOSTW10KeyParameters ipKey = (IPLOSTW10KeyParameters) key;

this.n = ipKey.getParameters().getN();

int N = (2 * n + 3);

this.pairing = PairingFactory.getPairing(ipKey.getParameters().getParameters());

this.productPairing = new ProductPairing(null, pairing, N);

this.keyBytes = pairing.getGT().getLengthInBytes();

this.outBytes = 2 * pairing.getGT().getLengthInBytes() + N * pairing.getG1().getLengthInBytes();

}

開發者ID:simonstey,項目名稱:SecureLinkedData,代碼行數:20,

示例3: fetchPartialPublicKey

​點讚 3

import it.unisa.dia.gas.plaf.jpbc.pairing.PairingFactory; //導入方法依賴的package包/類

@Override

public PartialPublicKeyInfo fetchPartialPublicKey(String keyID)

throws IOException

{

if (sharedPrivateKeyMap.containsKey(keyID))

{

BLS01Parameters params = paramsMap.get(keyID);

Share share = sharedPrivateKeyMap.getShare(keyID, TIME_OUT, TimeUnit.SECONDS);

Pairing pairing = PairingFactory.getPairing(params.getCurveParameters());

Element g = params.getG();

// calculate the public key

Element sk = pairing.getZr().newElement(share.getValue());

Element pk = g.powZn(sk);

return new PartialPublicKeyInfo(share.getSequenceNo(), SubjectPublicKeyInfoFactory.createSubjectPublicKeyInfo(new BLS01PublicKeyParameters(params, pk.getImmutable())));

}

return null;

}

開發者ID:cwgit,項目名稱:ximix,代碼行數:21,

示例4: unserializeBswabePub

​點讚 2

import it.unisa.dia.gas.plaf.jpbc.pairing.PairingFactory; //導入方法依賴的package包/類

public static BswabePub unserializeBswabePub(byte[] b) {

BswabePub pub;

int offset;

pub = new BswabePub();

offset = 0;

StringBuffer sb = new StringBuffer("");

offset = unserializeString(b, offset, sb);

pub.pairingDesc = sb.substring(0);

PropertiesParameters params = new PropertiesParameters()

.load(new ByteArrayInputStream(pub.pairingDesc.getBytes()));

pub.p = PairingFactory.getPairing(params);

//pub.p=PairingFactory.getPairing("params/curves/a.properties");

Pairing pairing = pub.p;

pub.g = pairing.getG1().newElement();

pub.h = pairing.getG1().newElement();

pub.gp = pairing.getG2().newElement();

pub.g_hat_alpha = pairing.getGT().newElement();

offset = unserializeElement(b, offset, pub.g);

offset = unserializeElement(b, offset, pub.h);

offset = unserializeElement(b, offset, pub.gp);

offset = unserializeElement(b, offset, pub.g_hat_alpha);

return pub;

}

開發者ID:simonstey,項目名稱:SecureLinkedData,代碼行數:30,

示例5: getPairing

​點讚 2

import it.unisa.dia.gas.plaf.jpbc.pairing.PairingFactory; //導入方法依賴的package包/類

public Pairing getPairing() {

if (p == null) {

PairingParameters params = new PropertiesParameters().load(new ByteArrayInputStream(pairingDesc.getBytes()));

p = PairingFactory.getPairing(params);

}

return p;

}

開發者ID:TU-Berlin-SNET,項目名稱:JCPABE,代碼行數:8,

示例6: generateSig

​點讚 2

import it.unisa.dia.gas.plaf.jpbc.pairing.PairingFactory; //導入方法依賴的pa

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Android studio 配置 jPBC 2.0.0 1、在压缩包的jars文件夹下找到下面两个文件:jpbc-api-2.0.0.jar    和   jpbc-plaf-2.0.0.jar 2、将上述两个jar包导入工程依赖包!!不会的百度一下Android studio怎么导入jar包!!! 3、在压缩包的jpbc-android文件夹下的assets文件夹下有4个用于测试的椭圆曲线常数Properties:a.properties、d159.properties、d201.properties,以及d224.properties,应该挪到Android 工程的assets文件夹下(当然也不一定非是这4个,只要是.properties参数文件都可以放进去,以供调用!!!),重点来了,Android studio 中并没有assets文件夹(assets文件夹是基于Eclipse进行android开发时专门存放资源文件的地方),怎么办呢?(android  studio老鸟勿喷)。实际上Android studio 也有存放资源文件的地方,那就是res文件夹!!!所以在Android strudio中我们可以新建一个与res文件夹并列的assets文件夹,具体步骤为:          点击main文件夹,然后右键---->New---->Folder---->Assets Folder---->点击完成      然后就可以发现main文件夹下多了一个assets资源文件夹!!!然后再把上述4个文件放进去就好了!!! 注意在加密中经常用到.properties文件,所以可以采用如下方式调用:                 Pairing pairing = PairingFactory.getPairing("assets/e_181_1024.properties");                 Field G = pairing.getG1();                 Field GT = pairing.getGT();                 Field Zq = pairing.getZr(); 之后就可以在工程里正常调用jpbc相关库函数并进行加密了!!!
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值