当前位置: 首页>>代码示例>>Java>>正文


Java RSAPrivateCrtKeyParameters.getQInv方法代码示例

本文整理汇总了Java中org.bouncycastle.crypto.params.RSAPrivateCrtKeyParameters.getQInv方法的典型用法代码示例。如果您正苦于以下问题:Java RSAPrivateCrtKeyParameters.getQInv方法的具体用法?Java RSAPrivateCrtKeyParameters.getQInv怎么用?Java RSAPrivateCrtKeyParameters.getQInv使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.bouncycastle.crypto.params.RSAPrivateCrtKeyParameters的用法示例。


在下文中一共展示了RSAPrivateCrtKeyParameters.getQInv方法的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();
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:18,代码来源:JCERSAPrivateCrtKey.java

示例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();
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:18,代码来源:BCRSAPrivateCrtKey.java

示例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()
	);
}
 
开发者ID:andy-goryachev,项目名称:PasswordSafe,代码行数:16,代码来源:Crypto.java

示例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();
}
 
开发者ID:rovemonteux,项目名称:silvertunnel-monteux,代码行数:18,代码来源:TempJCERSAPrivateCrtKey.java

示例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());
    }
}
 
开发者ID:dsaved,项目名称:africhat-platform-0.1,代码行数:39,代码来源:RSACoreEngine.java

示例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());
    }
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:43,代码来源:RSACoreEngine.java

示例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());
}
 
开发者ID:hsiafan,项目名称:byproxy,代码行数:7,代码来源:KeyStoreGenerator.java


注:本文中的org.bouncycastle.crypto.params.RSAPrivateCrtKeyParameters.getQInv方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。