本文整理匯總了Java中java.security.spec.RSAPrivateCrtKeySpec.getPublicExponent方法的典型用法代碼示例。如果您正苦於以下問題:Java RSAPrivateCrtKeySpec.getPublicExponent方法的具體用法?Java RSAPrivateCrtKeySpec.getPublicExponent怎麽用?Java RSAPrivateCrtKeySpec.getPublicExponent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.security.spec.RSAPrivateCrtKeySpec
的用法示例。
在下文中一共展示了RSAPrivateCrtKeySpec.getPublicExponent方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: JCERSAPrivateCrtKey
import java.security.spec.RSAPrivateCrtKeySpec; //導入方法依賴的package包/類
/**
* construct a private key from an RSAPrivateCrtKeySpec
*
* @param spec the spec to be used in construction.
*/
JCERSAPrivateCrtKey(
RSAPrivateCrtKeySpec spec)
{
this.modulus = spec.getModulus();
this.publicExponent = spec.getPublicExponent();
this.privateExponent = spec.getPrivateExponent();
this.primeP = spec.getPrimeP();
this.primeQ = spec.getPrimeQ();
this.primeExponentP = spec.getPrimeExponentP();
this.primeExponentQ = spec.getPrimeExponentQ();
this.crtCoefficient = spec.getCrtCoefficient();
}
示例2: BCRSAPrivateCrtKey
import java.security.spec.RSAPrivateCrtKeySpec; //導入方法依賴的package包/類
/**
* construct a private key from an RSAPrivateCrtKeySpec
*
* @param spec the spec to be used in construction.
*/
BCRSAPrivateCrtKey(
RSAPrivateCrtKeySpec spec)
{
this.modulus = spec.getModulus();
this.publicExponent = spec.getPublicExponent();
this.privateExponent = spec.getPrivateExponent();
this.primeP = spec.getPrimeP();
this.primeQ = spec.getPrimeQ();
this.primeExponentP = spec.getPrimeExponentP();
this.primeExponentQ = spec.getPrimeExponentQ();
this.crtCoefficient = spec.getCrtCoefficient();
}
示例3: TempJCERSAPrivateCrtKey
import java.security.spec.RSAPrivateCrtKeySpec; //導入方法依賴的package包/類
/**
* construct a private key from an RSAPrivateCrtKeySpec
*
* @param spec the spec to be used in construction.
*/
TempJCERSAPrivateCrtKey(
RSAPrivateCrtKeySpec spec)
{
this.modulus = spec.getModulus();
this.publicExponent = spec.getPublicExponent();
this.privateExponent = spec.getPrivateExponent();
this.primeP = spec.getPrimeP();
this.primeQ = spec.getPrimeQ();
this.primeExponentP = spec.getPrimeExponentP();
this.primeExponentQ = spec.getPrimeExponentQ();
this.crtCoefficient = spec.getCrtCoefficient();
}
示例4: init
import java.security.spec.RSAPrivateCrtKeySpec; //導入方法依賴的package包/類
private static OpenSSLKey init(RSAPrivateCrtKeySpec rsaKeySpec) throws InvalidKeySpecException {
BigInteger modulus = rsaKeySpec.getModulus();
BigInteger privateExponent = rsaKeySpec.getPrivateExponent();
if (modulus == null) {
throw new InvalidKeySpecException("modulus == null");
} else if (privateExponent == null) {
throw new InvalidKeySpecException("privateExponent == null");
}
try {
/*
* OpenSSL uses the public modulus to do RSA blinding. If
* the public modulus is not available, the call to
* EVP_PKEY_new_RSA will turn off blinding for this key
* instance.
*/
final BigInteger publicExponent = rsaKeySpec.getPublicExponent();
final BigInteger primeP = rsaKeySpec.getPrimeP();
final BigInteger primeQ = rsaKeySpec.getPrimeQ();
final BigInteger primeExponentP = rsaKeySpec.getPrimeExponentP();
final BigInteger primeExponentQ = rsaKeySpec.getPrimeExponentQ();
final BigInteger crtCoefficient = rsaKeySpec.getCrtCoefficient();
return new OpenSSLKey(NativeCrypto.EVP_PKEY_new_RSA(
modulus.toByteArray(),
publicExponent == null ? null : publicExponent.toByteArray(),
privateExponent.toByteArray(),
primeP == null ? null : primeP.toByteArray(),
primeQ == null ? null : primeQ.toByteArray(),
primeExponentP == null ? null : primeExponentP.toByteArray(),
primeExponentQ == null ? null : primeExponentQ.toByteArray(),
crtCoefficient == null ? null : crtCoefficient.toByteArray()));
} catch (Exception e) {
throw new InvalidKeySpecException(e);
}
}
示例5: decodeRSAPrivateKey
import java.security.spec.RSAPrivateCrtKeySpec; //導入方法依賴的package包/類
/**
* @param spec an instance of {@link RSAPrivateCrtKeySpec} to decode.
* @return an instance of {@link GnuRSAPrivateKey} constructed from the
* information in the designated key-specification.
*/
private PrivateKey decodeRSAPrivateKey(RSAPrivateCrtKeySpec spec)
{
BigInteger n = spec.getModulus();
BigInteger e = spec.getPublicExponent();
BigInteger d = spec.getPrivateExponent();
BigInteger p = spec.getPrimeP();
BigInteger q = spec.getPrimeQ();
BigInteger dP = spec.getPrimeExponentP();
BigInteger dQ = spec.getPrimeExponentQ();
BigInteger qInv = spec.getCrtCoefficient();
return new GnuRSAPrivateKey(Registry.PKCS8_ENCODING_ID,
n, e, d, p, q, dP, dQ, qInv);
}