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