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


Java RSAPrivateKey.getPrime2方法代码示例

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


在下文中一共展示了RSAPrivateKey.getPrime2方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getRSAPrivateKey

import org.bouncycastle.asn1.pkcs.RSAPrivateKey; //导入方法依赖的package包/类
public static APrivateKey getRSAPrivateKey(byte[] b) throws Exception
{
	ASN1InputStream in = new ASN1InputStream(b);
	try
	{
		ASN1Primitive x = in.readObject();
		RSAPrivateKey k = RSAPrivateKey.getInstance(x);

		return new APrivateKey(new RSAPrivateCrtKeyParameters
		(
			k.getModulus(), 
			k.getPublicExponent(),
			k.getPrivateExponent(),
			k.getPrime1(),
			k.getPrime2(),
			k.getExponent1(),
			k.getExponent2(),
			k.getCoefficient()
		));
	}
	finally
	{
		CKit.close(in);
	}
}
 
开发者ID:andy-goryachev,项目名称:PasswordSafe,代码行数:26,代码来源:Crypto.java

示例2: loadPrivateKeyResource

import org.bouncycastle.asn1.pkcs.RSAPrivateKey; //导入方法依赖的package包/类
static AsymmetricKeyParameter loadPrivateKeyResource(String resource)
    throws IOException
{

    PemObject pem = loadPemResource(resource);
    if (pem.getType().endsWith("RSA PRIVATE KEY"))
    {
        RSAPrivateKey rsa = RSAPrivateKey.getInstance(pem.getContent());
        return new RSAPrivateCrtKeyParameters(rsa.getModulus(), rsa.getPublicExponent(),
            rsa.getPrivateExponent(), rsa.getPrime1(), rsa.getPrime2(), rsa.getExponent1(),
            rsa.getExponent2(), rsa.getCoefficient());
    }
    if (pem.getType().endsWith("PRIVATE KEY"))
    {
        return PrivateKeyFactory.createKey(pem.getContent());
    }
    throw new IllegalArgumentException("'resource' doesn't specify a valid private key");
}
 
开发者ID:credentials,项目名称:irma_future_id,代码行数:19,代码来源:TlsTestUtils.java

示例3: JCERSAPrivateCrtKey

import org.bouncycastle.asn1.pkcs.RSAPrivateKey; //导入方法依赖的package包/类
/**
 * construct an RSA key from a ASN.1 RSA private key object.
 */
JCERSAPrivateCrtKey(
    RSAPrivateKey  key)
{
    this.modulus = key.getModulus();
    this.publicExponent = key.getPublicExponent();
    this.privateExponent = key.getPrivateExponent();
    this.primeP = key.getPrime1();
    this.primeQ = key.getPrime2();
    this.primeExponentP = key.getExponent1();
    this.primeExponentQ = key.getExponent2();
    this.crtCoefficient = key.getCoefficient();
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:16,代码来源:JCERSAPrivateCrtKey.java

示例4: BCRSAPrivateCrtKey

import org.bouncycastle.asn1.pkcs.RSAPrivateKey; //导入方法依赖的package包/类
/**
 * construct an RSA key from a ASN.1 RSA private key object.
 */
BCRSAPrivateCrtKey(
    RSAPrivateKey key)
{
    this.modulus = key.getModulus();
    this.publicExponent = key.getPublicExponent();
    this.privateExponent = key.getPrivateExponent();
    this.primeP = key.getPrime1();
    this.primeQ = key.getPrime2();
    this.primeExponentP = key.getExponent1();
    this.primeExponentQ = key.getExponent2();
    this.crtCoefficient = key.getCoefficient();
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:16,代码来源:BCRSAPrivateCrtKey.java

示例5: TempJCERSAPrivateCrtKey

import org.bouncycastle.asn1.pkcs.RSAPrivateKey; //导入方法依赖的package包/类
/**
 * construct an RSA key from a ASN.1 RSA private key object.
 */
TempJCERSAPrivateCrtKey(
    RSAPrivateKey  key)
{
    this.modulus = key.getModulus();
    this.publicExponent = key.getPublicExponent();
    this.privateExponent = key.getPrivateExponent();
    this.primeP = key.getPrime1();
    this.primeQ = key.getPrime2();
    this.primeExponentP = key.getExponent1();
    this.primeExponentQ = key.getExponent2();
    this.crtCoefficient = key.getCoefficient();
}
 
开发者ID:rovemonteux,项目名称:silvertunnel-monteux,代码行数:16,代码来源:TempJCERSAPrivateCrtKey.java

示例6: baseOaepTest

import org.bouncycastle.asn1.pkcs.RSAPrivateKey; //导入方法依赖的package包/类
private void baseOaepTest(
    int     id,
    byte[]  pubKeyEnc,
    byte[]  privKeyEnc,
    byte[]  output)
    throws Exception
{
    ByteArrayInputStream    bIn = new ByteArrayInputStream(pubKeyEnc);
    ASN1InputStream         dIn = new ASN1InputStream(bIn);

    //
    // extract the public key info.
    //
    RSAPublicKey pubStruct;

    pubStruct = RSAPublicKey.getInstance(new SubjectPublicKeyInfo((ASN1Sequence)dIn.readObject()).parsePublicKey());


    bIn = new ByteArrayInputStream(privKeyEnc);
    dIn = new ASN1InputStream(bIn);

    //
    // extract the private key info.
    //
    RSAPrivateKey privStruct;

    privStruct = RSAPrivateKey.getInstance(new PrivateKeyInfo((ASN1Sequence)dIn.readObject()).parsePrivateKey());

    RSAKeyParameters    pubParameters = new RSAKeyParameters(
                                                false,
                                                pubStruct.getModulus(),
                                                pubStruct.getPublicExponent());

    RSAKeyParameters    privParameters = new RSAPrivateCrtKeyParameters(
                                                privStruct.getModulus(),
                                                privStruct.getPublicExponent(),
                                                privStruct.getPrivateExponent(),
                                                privStruct.getPrime1(),
                                                privStruct.getPrime2(),
                                                privStruct.getExponent1(),
                                                privStruct.getExponent2(),
                                                privStruct.getCoefficient());

    byte[]  input = new byte[]
                { (byte)0x54, (byte)0x85, (byte)0x9b, (byte)0x34, (byte)0x2c, (byte)0x49, (byte)0xea, (byte)0x2a };

    encDec("id(" + id + ")", pubParameters, privParameters, seed, input, output);

}
 
开发者ID:credentials,项目名称:irma_future_id,代码行数:50,代码来源:OAEPTest.java


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