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


Java RSAPrivateKeySpec.getPrivateExponent方法代码示例

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


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

示例1: init

import java.security.spec.RSAPrivateKeySpec; //导入方法依赖的package包/类
private static OpenSSLKey init(RSAPrivateKeySpec rsaKeySpec) throws InvalidKeySpecException {
    final BigInteger modulus = rsaKeySpec.getModulus();
    final BigInteger privateExponent = rsaKeySpec.getPrivateExponent();

    if (modulus == null) {
        throw new InvalidKeySpecException("modulus == null");
    } else if (privateExponent == null) {
        throw new InvalidKeySpecException("privateExponent == null");
    }

    try {
        return new OpenSSLKey(NativeCrypto.EVP_PKEY_new_RSA(
                modulus.toByteArray(),
                null,
                privateExponent.toByteArray(),
                null,
                null,
                null,
                null,
                null));
    } catch (Exception e) {
        throw new InvalidKeySpecException(e);
    }
}
 
开发者ID:google,项目名称:conscrypt,代码行数:25,代码来源:OpenSSLRSAPrivateKey.java

示例2: testRSA

import java.security.spec.RSAPrivateKeySpec; //导入方法依赖的package包/类
@Test
public void testRSA() throws Exception {
	KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance("RSA");
	assertNotNull(keyPairGenerator);
	keyPairGenerator.initialize(1024);
	KeyPair keyPair = keyPairGenerator.genKeyPair();
	assertNotNull(keyPair);
	PublicKey publicKey = keyPair.getPublic();
	assertNotNull(publicKey);
	PrivateKey privateKey = keyPair.getPrivate();
	assertNotNull(privateKey);

	KeyFactory keyFactory = KeyFactory.getInstance("RSA");
	assertNotNull(keyFactory);
	RSAPrivateKeySpec privateKeySpec = keyFactory.getKeySpec(privateKey,
			RSAPrivateKeySpec.class);
	assertNotNull(privateKeySpec);
	RSAPublicKeySpec publicKeySpec = keyFactory.getKeySpec(publicKey,
			RSAPublicKeySpec.class);
	assertNotNull(publicKeySpec);

	BigInteger privateModulus = privateKeySpec.getModulus();
	assertNotNull(privateModulus);
	BigInteger privateExponent = privateKeySpec.getPrivateExponent();
	assertNotNull(privateExponent);

	BigInteger publicModulus = publicKeySpec.getModulus();
	assertNotNull(publicModulus);
	BigInteger publicExponent = publicKeySpec.getPublicExponent();
	assertNotNull(publicExponent);

	System.out.println("privateModulus: " + privateModulus);
	System.out.println("privateExponent: " + privateExponent);
	System.out.println("publicModulus: " + publicModulus);
	System.out.println("publicExponent: " + publicExponent);
}
 
开发者ID:PureSolTechnologies,项目名称:Purifinity,代码行数:37,代码来源:CryptographyTest.java

示例3: JCERSAPrivateKey

import java.security.spec.RSAPrivateKeySpec; //导入方法依赖的package包/类
JCERSAPrivateKey(
    RSAPrivateKeySpec spec)
{
    this.modulus = spec.getModulus();
    this.privateExponent = spec.getPrivateExponent();
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:7,代码来源:JCERSAPrivateKey.java

示例4: BCRSAPrivateKey

import java.security.spec.RSAPrivateKeySpec; //导入方法依赖的package包/类
BCRSAPrivateKey(
    RSAPrivateKeySpec spec)
{
    this.modulus = spec.getModulus();
    this.privateExponent = spec.getPrivateExponent();
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:7,代码来源:BCRSAPrivateKey.java

示例5: TempJCERSAPrivateKey

import java.security.spec.RSAPrivateKeySpec; //导入方法依赖的package包/类
TempJCERSAPrivateKey(
    RSAPrivateKeySpec spec)
{
    this.modulus = spec.getModulus();
    this.privateExponent = spec.getPrivateExponent();
}
 
开发者ID:B4dT0bi,项目名称:silvertunnel-ng,代码行数:7,代码来源:TempJCERSAPrivateKey.java

示例6: IosRSAPrivateKey

import java.security.spec.RSAPrivateKeySpec; //导入方法依赖的package包/类
public IosRSAPrivateKey(RSAPrivateKeySpec spec) {
  super(spec.getModulus());
  this.privateExponent = spec.getPrivateExponent();
}
 
开发者ID:Sellegit,项目名称:j2objc,代码行数:5,代码来源:IosRSAKey.java


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