本文整理汇总了Java中org.bouncycastle.crypto.params.NaccacheSternPrivateKeyParameters.getSmallPrimes方法的典型用法代码示例。如果您正苦于以下问题:Java NaccacheSternPrivateKeyParameters.getSmallPrimes方法的具体用法?Java NaccacheSternPrivateKeyParameters.getSmallPrimes怎么用?Java NaccacheSternPrivateKeyParameters.getSmallPrimes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bouncycastle.crypto.params.NaccacheSternPrivateKeyParameters
的用法示例。
在下文中一共展示了NaccacheSternPrivateKeyParameters.getSmallPrimes方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import org.bouncycastle.crypto.params.NaccacheSternPrivateKeyParameters; //导入方法依赖的package包/类
/**
* Initializes this algorithm. Must be called before all other Functions.
*
* @see org.bouncycastle.crypto.AsymmetricBlockCipher#init(boolean,
* org.bouncycastle.crypto.CipherParameters)
*/
public void init(boolean forEncryption, CipherParameters param)
{
this.forEncryption = forEncryption;
if (param instanceof ParametersWithRandom)
{
param = ((ParametersWithRandom) param).getParameters();
}
key = (NaccacheSternKeyParameters)param;
// construct lookup table for faster decryption if necessary
if (!this.forEncryption)
{
if (debug)
{
System.out.println("Constructing lookup Array");
}
NaccacheSternPrivateKeyParameters priv = (NaccacheSternPrivateKeyParameters)key;
Vector primes = priv.getSmallPrimes();
lookup = new Vector[primes.size()];
for (int i = 0; i < primes.size(); i++)
{
BigInteger actualPrime = (BigInteger)primes.elementAt(i);
int actualPrimeValue = actualPrime.intValue();
lookup[i] = new Vector();
lookup[i].addElement(ONE);
if (debug)
{
System.out.println("Constructing lookup ArrayList for " + actualPrimeValue);
}
BigInteger accJ = ZERO;
for (int j = 1; j < actualPrimeValue; j++)
{
accJ = accJ.add(priv.getPhi_n());
BigInteger comp = accJ.divide(actualPrime);
lookup[i].addElement(priv.getG().modPow(comp, priv.getModulus()));
}
}
}
}