本文整理汇总了Java中org.bouncycastle.crypto.params.RSAPrivateCrtKeyParameters.getQ方法的典型用法代码示例。如果您正苦于以下问题:Java RSAPrivateCrtKeyParameters.getQ方法的具体用法?Java RSAPrivateCrtKeyParameters.getQ怎么用?Java RSAPrivateCrtKeyParameters.getQ使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bouncycastle.crypto.params.RSAPrivateCrtKeyParameters
的用法示例。
在下文中一共展示了RSAPrivateCrtKeyParameters.getQ方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: JCERSAPrivateCrtKey
import org.bouncycastle.crypto.params.RSAPrivateCrtKeyParameters; //导入方法依赖的package包/类
/**
* construct a private key from it's org.bouncycastle.crypto equivalent.
*
* @param key the parameters object representing the private key.
*/
JCERSAPrivateCrtKey(
RSAPrivateCrtKeyParameters key)
{
super(key);
this.publicExponent = key.getPublicExponent();
this.primeP = key.getP();
this.primeQ = key.getQ();
this.primeExponentP = key.getDP();
this.primeExponentQ = key.getDQ();
this.crtCoefficient = key.getQInv();
}
示例2: BCRSAPrivateCrtKey
import org.bouncycastle.crypto.params.RSAPrivateCrtKeyParameters; //导入方法依赖的package包/类
/**
* construct a private key from it's org.bouncycastle.crypto equivalent.
*
* @param key the parameters object representing the private key.
*/
BCRSAPrivateCrtKey(
RSAPrivateCrtKeyParameters key)
{
super(key);
this.publicExponent = key.getPublicExponent();
this.primeP = key.getP();
this.primeQ = key.getQ();
this.primeExponentP = key.getDP();
this.primeExponentQ = key.getDQ();
this.crtCoefficient = key.getQInv();
}
示例3: toRSAPrivateKey
import org.bouncycastle.crypto.params.RSAPrivateCrtKeyParameters; //导入方法依赖的package包/类
public static RSAPrivateKey toRSAPrivateKey(RSAPrivateCrtKeyParameters k) throws Exception
{
// hope this is correct
return new RSAPrivateKey
(
k.getModulus(),
k.getPublicExponent(),
k.getExponent(),
k.getP(),
k.getQ(),
k.getDP(),
k.getDQ(),
k.getQInv()
);
}
示例4: TempJCERSAPrivateCrtKey
import org.bouncycastle.crypto.params.RSAPrivateCrtKeyParameters; //导入方法依赖的package包/类
/**
* construct a private key from it's org.bouncycastle.crypto equivalent.
*
* @param key the parameters object representing the private key.
*/
TempJCERSAPrivateCrtKey(
RSAPrivateCrtKeyParameters key)
{
super(key);
this.publicExponent = key.getPublicExponent();
this.primeP = key.getP();
this.primeQ = key.getQ();
this.primeExponentP = key.getDP();
this.primeExponentQ = key.getDQ();
this.crtCoefficient = key.getQInv();
}
示例5: processBlock
import org.bouncycastle.crypto.params.RSAPrivateCrtKeyParameters; //导入方法依赖的package包/类
public BigInteger processBlock(BigInteger input) {
if (key instanceof RSAPrivateCrtKeyParameters) {
//
// we have the extra factors, use the Chinese Remainder Theorem - the author
// wishes to express his thanks to Dirk Bonekaemper at rtsffm.com for
// advice regarding the expression of this.
//
RSAPrivateCrtKeyParameters crtKey = (RSAPrivateCrtKeyParameters) key;
BigInteger p = crtKey.getP();
BigInteger q = crtKey.getQ();
BigInteger dP = crtKey.getDP();
BigInteger dQ = crtKey.getDQ();
BigInteger qInv = crtKey.getQInv();
BigInteger mP, mQ, h, m;
// mP = ((input mod p) ^ dP)) mod p
mP = (input.remainder(p)).modPow(dP, p);
// mQ = ((input mod q) ^ dQ)) mod q
mQ = (input.remainder(q)).modPow(dQ, q);
// h = qInv * (mP - mQ) mod p
h = mP.subtract(mQ);
h = h.multiply(qInv);
h = h.mod(p); // mod (in Java) returns the positive residual
// m = h * q + mQ
m = h.multiply(q);
m = m.add(mQ);
return m;
} else {
return input.modPow(
key.getExponent(), key.getModulus());
}
}
示例6: processBlock
import org.bouncycastle.crypto.params.RSAPrivateCrtKeyParameters; //导入方法依赖的package包/类
public BigInteger processBlock(BigInteger input)
{
if (key instanceof RSAPrivateCrtKeyParameters)
{
//
// we have the extra factors, use the Chinese Remainder Theorem - the author
// wishes to express his thanks to Dirk Bonekaemper at rtsffm.com for
// advice regarding the expression of this.
//
RSAPrivateCrtKeyParameters crtKey = (RSAPrivateCrtKeyParameters)key;
BigInteger p = crtKey.getP();
BigInteger q = crtKey.getQ();
BigInteger dP = crtKey.getDP();
BigInteger dQ = crtKey.getDQ();
BigInteger qInv = crtKey.getQInv();
BigInteger mP, mQ, h, m;
// mP = ((input mod p) ^ dP)) mod p
mP = (input.remainder(p)).modPow(dP, p);
// mQ = ((input mod q) ^ dQ)) mod q
mQ = (input.remainder(q)).modPow(dQ, q);
// h = qInv * (mP - mQ) mod p
h = mP.subtract(mQ);
h = h.multiply(qInv);
h = h.mod(p); // mod (in Java) returns the positive residual
// m = h * q + mQ
m = h.multiply(q);
m = m.add(mQ);
return m;
}
else
{
return input.modPow(
key.getExponent(), key.getModulus());
}
}
示例7: getKeySpec
import org.bouncycastle.crypto.params.RSAPrivateCrtKeyParameters; //导入方法依赖的package包/类
private static RSAPrivateCrtKeySpec getKeySpec(RSAPrivateCrtKeyParameters privateKeyParameters) {
return new RSAPrivateCrtKeySpec(privateKeyParameters.getModulus(),
privateKeyParameters.getPublicExponent(), privateKeyParameters.getExponent(),
privateKeyParameters.getP(), privateKeyParameters.getQ(),
privateKeyParameters.getDP(), privateKeyParameters.getDQ(), privateKeyParameters.getQInv());
}