當前位置: 首頁>>代碼示例>>Java>>正文


Java RSAPrivateCrtKeySpec.getPrivateExponent方法代碼示例

本文整理匯總了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();
}
 
開發者ID:Appdome,項目名稱:ipack,代碼行數:18,代碼來源:JCERSAPrivateCrtKey.java

示例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();
}
 
開發者ID:Appdome,項目名稱:ipack,代碼行數:18,代碼來源:BCRSAPrivateCrtKey.java

示例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();
}
 
開發者ID:B4dT0bi,項目名稱:silvertunnel-ng,代碼行數:18,代碼來源:TempJCERSAPrivateCrtKey.java

示例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);
    }
}
 
開發者ID:google,項目名稱:conscrypt,代碼行數:38,代碼來源:OpenSSLRSAPrivateCrtKey.java

示例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);
}
 
開發者ID:vilie,項目名稱:javify,代碼行數:19,代碼來源:EncodedKeyFactory.java


注:本文中的java.security.spec.RSAPrivateCrtKeySpec.getPrivateExponent方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。