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


Java RSAKeyGenParameterSpec.getPublicExponent方法代碼示例

本文整理匯總了Java中java.security.spec.RSAKeyGenParameterSpec.getPublicExponent方法的典型用法代碼示例。如果您正苦於以下問題:Java RSAKeyGenParameterSpec.getPublicExponent方法的具體用法?Java RSAKeyGenParameterSpec.getPublicExponent怎麽用?Java RSAKeyGenParameterSpec.getPublicExponent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.security.spec.RSAKeyGenParameterSpec的用法示例。


在下文中一共展示了RSAKeyGenParameterSpec.getPublicExponent方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: initialize

import java.security.spec.RSAKeyGenParameterSpec; //導入方法依賴的package包/類
public void initialize(
    AlgorithmParameterSpec params,
    SecureRandom random)
    throws InvalidAlgorithmParameterException
{
    if (!(params instanceof RSAKeyGenParameterSpec))
    {
        throw new InvalidAlgorithmParameterException("parameter object not a RSAKeyGenParameterSpec");
    }
    RSAKeyGenParameterSpec rsaParams = (RSAKeyGenParameterSpec)params;

    param = new RSAKeyGenerationParameters(
        rsaParams.getPublicExponent(),
        random, rsaParams.getKeysize(), defaultTests);

    engine.init(param);
}
 
開發者ID:Appdome,項目名稱:ipack,代碼行數:18,代碼來源:KeyPairGeneratorSpi.java

示例2: initialize

import java.security.spec.RSAKeyGenParameterSpec; //導入方法依賴的package包/類
@Override
public void initialize(AlgorithmParameterSpec params, SecureRandom random)
        throws InvalidAlgorithmParameterException {
    if (!(params instanceof RSAKeyGenParameterSpec)) {
        throw new InvalidAlgorithmParameterException("Only RSAKeyGenParameterSpec supported");
    }

    RSAKeyGenParameterSpec spec = (RSAKeyGenParameterSpec) params;

    final BigInteger publicExponent = spec.getPublicExponent();
    if (publicExponent != null) {
        this.publicExponent = publicExponent.toByteArray();
    }

    this.modulusBits = spec.getKeysize();
}
 
開發者ID:google,項目名稱:conscrypt,代碼行數:17,代碼來源:OpenSSLRSAKeyPairGenerator.java

示例3: initialize

import java.security.spec.RSAKeyGenParameterSpec; //導入方法依賴的package包/類
public void initialize(
    AlgorithmParameterSpec  params,
    SecureRandom            random)
    throws InvalidAlgorithmParameterException
{
    if (!(params instanceof RSAKeyGenParameterSpec))
    {
        throw new InvalidAlgorithmParameterException("parameter object not a RSAKeyGenParameterSpec");
    }
    RSAKeyGenParameterSpec     rsaParams = (RSAKeyGenParameterSpec)params;

    param = new RSAKeyGenerationParameters(
                    rsaParams.getPublicExponent(),
                    random, rsaParams.getKeysize(), defaultTests);

    engine.init(param);
}
 
開發者ID:bullda,項目名稱:DroidText,代碼行數:18,代碼來源:JDKKeyPairGenerator.java

示例4: initialize

import java.security.spec.RSAKeyGenParameterSpec; //導入方法依賴的package包/類
public void initialize(AlgorithmParameterSpec params, SecureRandom random)
        throws InvalidAlgorithmParameterException {

    if (params instanceof RSAKeyGenParameterSpec == false) {
        throw new InvalidAlgorithmParameterException
            ("Params must be instance of RSAKeyGenParameterSpec");
    }

    RSAKeyGenParameterSpec rsaSpec = (RSAKeyGenParameterSpec)params;
    int tmpKeySize = rsaSpec.getKeysize();
    BigInteger tmpPublicExponent = rsaSpec.getPublicExponent();

    if (tmpPublicExponent == null) {
        tmpPublicExponent = RSAKeyGenParameterSpec.F4;
    } else {
        if (tmpPublicExponent.compareTo(RSAKeyGenParameterSpec.F0) < 0) {
            throw new InvalidAlgorithmParameterException
                    ("Public exponent must be 3 or larger");
        }
        if (tmpPublicExponent.bitLength() > tmpKeySize) {
            throw new InvalidAlgorithmParameterException
                    ("Public exponent must be smaller than key size");
        }
    }

    // do not allow unreasonably large key sizes, probably user error
    try {
        RSAKeyFactory.checkKeyLengths(tmpKeySize, tmpPublicExponent,
            512, 64 * 1024);
    } catch (InvalidKeyException e) {
        throw new InvalidAlgorithmParameterException(
            "Invalid key sizes", e);
    }

    this.keySize = tmpKeySize;
    this.publicExponent = tmpPublicExponent;
    this.random = random;
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:39,代碼來源:RSAKeyPairGenerator.java

示例5: setup

import java.security.spec.RSAKeyGenParameterSpec; //導入方法依賴的package包/類
/**
 * Configures this instance.
 *
 * @param attributes the map of name/value pairs to use.
 * @exception IllegalArgumentException if the designated MODULUS_LENGTH value
 *              is less than 1024.
 */
public void setup(Map attributes)
{
  if (Configuration.DEBUG)
    log.entering(this.getClass().getName(), "setup", attributes);
  // do we have a SecureRandom, or should we use our own?
  rnd = (SecureRandom) attributes.get(SOURCE_OF_RANDOMNESS);
  // are we given a set of RSA params or we shall use our own?
  RSAKeyGenParameterSpec params = (RSAKeyGenParameterSpec) attributes.get(RSA_PARAMETERS);
  // find out the modulus length
  if (params != null)
    {
      L = params.getKeysize();
      e = params.getPublicExponent();
    }
  else
    {
      Integer l = (Integer) attributes.get(MODULUS_LENGTH);
      L = (l == null ? DEFAULT_MODULUS_LENGTH : l.intValue());
    }
  if (L < 1024)
    throw new IllegalArgumentException(MODULUS_LENGTH);

  // what is the preferred encoding format
  Integer formatID = (Integer) attributes.get(PREFERRED_ENCODING_FORMAT);
  preferredFormat = formatID == null ? DEFAULT_ENCODING_FORMAT
                                     : formatID.intValue();
  if (Configuration.DEBUG)
    log.exiting(this.getClass().getName(), "setup");
}
 
開發者ID:vilie,項目名稱:javify,代碼行數:37,代碼來源:RSAKeyPairGenerator.java

示例6: setup

import java.security.spec.RSAKeyGenParameterSpec; //導入方法依賴的package包/類
/**
 * Configures this instance.
 * 
 * @param attributes the map of name/value pairs to use.
 * @exception IllegalArgumentException if the designated MODULUS_LENGTH value
 *              is less than 1024.
 */
public void setup(Map attributes)
{
  if (Configuration.DEBUG)
    log.entering(this.getClass().getName(), "setup", attributes);
  // do we have a SecureRandom, or should we use our own?
  rnd = (SecureRandom) attributes.get(SOURCE_OF_RANDOMNESS);
  // are we given a set of RSA params or we shall use our own?
  RSAKeyGenParameterSpec params = (RSAKeyGenParameterSpec) attributes.get(RSA_PARAMETERS);
  // find out the modulus length
  if (params != null)
    {
      L = params.getKeysize();
      e = params.getPublicExponent();
    }
  else
    {
      Integer l = (Integer) attributes.get(MODULUS_LENGTH);
      L = (l == null ? DEFAULT_MODULUS_LENGTH : l.intValue());
    }
  if (L < 1024)
    throw new IllegalArgumentException(MODULUS_LENGTH);

  // what is the preferred encoding format
  Integer formatID = (Integer) attributes.get(PREFERRED_ENCODING_FORMAT);
  preferredFormat = formatID == null ? DEFAULT_ENCODING_FORMAT
                                     : formatID.intValue();
  if (Configuration.DEBUG)
    log.exiting(this.getClass().getName(), "setup");
}
 
開發者ID:nmldiegues,項目名稱:jvm-stm,代碼行數:37,代碼來源:RSAKeyPairGenerator.java


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