本文整理匯總了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);
}
}
示例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);
}
示例3: JCERSAPrivateKey
import java.security.spec.RSAPrivateKeySpec; //導入方法依賴的package包/類
JCERSAPrivateKey(
RSAPrivateKeySpec spec)
{
this.modulus = spec.getModulus();
this.privateExponent = spec.getPrivateExponent();
}
示例4: BCRSAPrivateKey
import java.security.spec.RSAPrivateKeySpec; //導入方法依賴的package包/類
BCRSAPrivateKey(
RSAPrivateKeySpec spec)
{
this.modulus = spec.getModulus();
this.privateExponent = spec.getPrivateExponent();
}
示例5: TempJCERSAPrivateKey
import java.security.spec.RSAPrivateKeySpec; //導入方法依賴的package包/類
TempJCERSAPrivateKey(
RSAPrivateKeySpec spec)
{
this.modulus = spec.getModulus();
this.privateExponent = spec.getPrivateExponent();
}
示例6: IosRSAPrivateKey
import java.security.spec.RSAPrivateKeySpec; //導入方法依賴的package包/類
public IosRSAPrivateKey(RSAPrivateKeySpec spec) {
super(spec.getModulus());
this.privateExponent = spec.getPrivateExponent();
}