本文整理汇总了Java中org.bouncycastle.pqc.math.linearalgebra.GoppaCode类的典型用法代码示例。如果您正苦于以下问题:Java GoppaCode类的具体用法?Java GoppaCode怎么用?Java GoppaCode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GoppaCode类属于org.bouncycastle.pqc.math.linearalgebra包,在下文中一共展示了GoppaCode类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: generateKeyPair
import org.bouncycastle.pqc.math.linearalgebra.GoppaCode; //导入依赖的package包/类
public AsymmetricCipherKeyPair generateKeyPair()
{
if (!initialized)
{
initializeDefault();
}
// finite field GF(2^m)
GF2mField field = new GF2mField(m, fieldPoly);
// irreducible Goppa polynomial
PolynomialGF2mSmallM gp = new PolynomialGF2mSmallM(field, t,
PolynomialGF2mSmallM.RANDOM_IRREDUCIBLE_POLYNOMIAL, random);
PolynomialRingGF2m ring = new PolynomialRingGF2m(field, gp);
// matrix for computing square roots in (GF(2^m))^t
PolynomialGF2mSmallM[] qInv = ring.getSquareRootMatrix();
// generate canonical check matrix
GF2Matrix h = GoppaCode.createCanonicalCheckMatrix(field, gp);
// compute short systematic form of check matrix
MaMaPe mmp = GoppaCode.computeSystematicForm(h, random);
GF2Matrix shortH = mmp.getSecondMatrix();
Permutation p = mmp.getPermutation();
// compute short systematic form of generator matrix
GF2Matrix shortG = (GF2Matrix)shortH.computeTranspose();
// obtain number of rows of G (= dimension of the code)
int k = shortG.getNumRows();
// generate keys
McElieceCCA2PublicKeyParameters pubKey = new McElieceCCA2PublicKeyParameters(OID, n, t, shortG, mcElieceCCA2Params.getParameters());
McElieceCCA2PrivateKeyParameters privKey = new McElieceCCA2PrivateKeyParameters(OID, n, k,
field, gp, p, h, qInv, mcElieceCCA2Params.getParameters());
// return key pair
return new AsymmetricCipherKeyPair(pubKey, privKey);
}
开发者ID:Appdome,项目名称:ipack,代码行数:42,代码来源:McElieceCCA2KeyPairGenerator.java
注:本文中的org.bouncycastle.pqc.math.linearalgebra.GoppaCode类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论