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


Java RSAPrivateCrtKeyParameters.getPublicExponent方法代码示例

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


在下文中一共展示了RSAPrivateCrtKeyParameters.getPublicExponent方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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包/类
/**
 * Process a single block using the basic RSA algorithm.
 *
 * @param in the input array.
 * @param inOff the offset into the input buffer where the data starts.
 * @param inLen the length of the data to be processed.
 * @return the result of the RSA process.
 * @exception DataLengthException the input block is too large.
 */
public byte[] processBlock(
    byte[]  in,
    int     inOff,
    int     inLen)
{
    if (key == null)
    {
        throw new IllegalStateException("RSA engine not initialised");
    }

    BigInteger input = core.convertInput(in, inOff, inLen);

    BigInteger result;
    if (key instanceof RSAPrivateCrtKeyParameters)
    {
        RSAPrivateCrtKeyParameters k = (RSAPrivateCrtKeyParameters)key;

        BigInteger e = k.getPublicExponent();
        if (e != null)   // can't do blinding without a public exponent
        {
            BigInteger m = k.getModulus();
            BigInteger r = BigIntegers.createRandomInRange(ONE, m.subtract(ONE), random);

            BigInteger blindedInput = r.modPow(e, m).multiply(input).mod(m);
            BigInteger blindedResult = core.processBlock(blindedInput);

            BigInteger rInv = r.modInverse(m);
            result = blindedResult.multiply(rInv).mod(m);
        }
        else
        {
            result = core.processBlock(input);
        }
    }
    else
    {
        result = core.processBlock(input);
    }

    return core.convertOutput(result);
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:51,代码来源:RSABlindedEngine.java

示例6: processBlock

import org.bouncycastle.crypto.params.RSAPrivateCrtKeyParameters; //导入方法依赖的package包/类
/**
 * Process a single block using the basic RSA algorithm.
 *
 * @param in the input array.
 * @param inOff the offset into the input buffer where the data starts.
 * @param inLen the length of the data to be processed.
 * @return the result of the RSA process.
 * @exception DataLengthException the input block is too large.
 */
public byte[] processBlock(
    byte[]  in,
    int     inOff,
    int     inLen)
{
    if (key == null)
    {
        throw new IllegalStateException("RSA engine not initialised");
    }

    BigInteger input = core.convertInput(in, inOff, inLen);

    BigInteger result;
    if (key instanceof RSAPrivateCrtKeyParameters)
    {
        RSAPrivateCrtKeyParameters k = (RSAPrivateCrtKeyParameters)key;

        BigInteger e = k.getPublicExponent();
        if (e != null)   // can't do blinding without a public exponent
        {
            BigInteger m = k.getModulus();
            BigInteger r = BigIntegers.createRandomInRange(ONE, m.subtract(ONE), random);

            BigInteger blindedInput = r.modPow(e, m).multiply(input).mod(m);
            BigInteger blindedResult = core.processBlock(blindedInput);

            BigInteger rInv = r.modInverse(m);
            result = blindedResult.multiply(rInv).mod(m);
            // defence against Arjen Lenstra’s CRT attack
            if (!input.equals(result.modPow(e, m)))
            {
                throw new IllegalStateException("RSA engine faulty decryption/signing detected");
            }
        }
        else
        {
            result = core.processBlock(input);
        }
    }
    else
    {
        result = core.processBlock(input);
    }

    return core.convertOutput(result);
}
 
开发者ID:ttt43ttt,项目名称:gwt-crypto,代码行数:56,代码来源:RSABlindedEngine.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

示例8: processBlock

import org.bouncycastle.crypto.params.RSAPrivateCrtKeyParameters; //导入方法依赖的package包/类
/**
 * Process a single block using the basic RSA algorithm.
 *
 * @param in the input array.
 * @param inOff the offset into the input buffer where the data starts.
 * @param inLen the length of the data to be processed.
 * @return the result of the RSA process.
 * @exception DataLengthException the input block is too large.
 */
@Override
public byte[] processBlock(final byte[] in, final int inOff, final int inLen) {
    if (key == null) {
        throw new IllegalStateException("RSA engine not initialised");
    }

    BigInteger input = core.convertInput(in, inOff, inLen);

    BigInteger result;
    if (key instanceof RSAPrivateCrtKeyParameters) {
        RSAPrivateCrtKeyParameters k = (RSAPrivateCrtKeyParameters)key;

        BigInteger e = k.getPublicExponent();
        // can't do blinding without a public exponent
        if (e != null) {
            BigInteger m = k.getModulus();
            BigInteger r = BigIntegers.createRandomInRange(ONE, m.subtract(ONE), random);

            // This is a modification to use the GMP native library method
            BigInteger blindedModPow = Gmp.modPowSecure(r, e, m);

            BigInteger blindedInput = blindedModPow.multiply(input).mod(m);
            BigInteger blindedResult = core.processBlock(blindedInput);

            // This is a modification to use the GMP native library method
            BigInteger rInv = Gmp.modInverse(r, m);

            result = blindedResult.multiply(rInv).mod(m);
            // defence against Arjen Lenstra’s CRT attack
            // This is a modification to use the GMP native library method
            if (!input.equals(Gmp.modPowInsecure(result, e, m))) {
                throw new IllegalStateException("RSA engine faulty decryption/signing detected");
            }
        } else {
            result = core.processBlock(input);
        }
    } else {
        result = core.processBlock(input);
    }

    return core.convertOutput(result);
}
 
开发者ID:joyent,项目名称:java-http-signature,代码行数:52,代码来源:NativeRSABlindedEngine.java


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