src/java.base/share/classes/java/security/spec/RSAKeyGenParameterSpec.java
changeset 50204 3195a713e24d
parent 47216 71c04702a3d5
child 56592 b1902b22005e
equal deleted inserted replaced
50203:39d88709b138 50204:3195a713e24d
     1 /*
     1 /*
     2  * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
    41 
    41 
    42 public class RSAKeyGenParameterSpec implements AlgorithmParameterSpec {
    42 public class RSAKeyGenParameterSpec implements AlgorithmParameterSpec {
    43 
    43 
    44     private int keysize;
    44     private int keysize;
    45     private BigInteger publicExponent;
    45     private BigInteger publicExponent;
       
    46     private AlgorithmParameterSpec keyParams;
    46 
    47 
    47     /**
    48     /**
    48      * The public-exponent value F0 = 3.
    49      * The public-exponent value F0 = 3.
    49      */
    50      */
    50     public static final BigInteger F0 = BigInteger.valueOf(3);
    51     public static final BigInteger F0 = BigInteger.valueOf(3);
    53      * The public exponent-value F4 = 65537.
    54      * The public exponent-value F4 = 65537.
    54      */
    55      */
    55     public static final BigInteger F4 = BigInteger.valueOf(65537);
    56     public static final BigInteger F4 = BigInteger.valueOf(65537);
    56 
    57 
    57     /**
    58     /**
    58      * Constructs a new {@code RSAParameterSpec} object from the
    59      * Constructs a new {@code RSAKeyGenParameterSpec} object from the
    59      * given keysize and public-exponent value.
    60      * given keysize, public-exponent value, and null key parameters.
    60      *
    61      *
    61      * @param keysize the modulus size (specified in number of bits)
    62      * @param keysize the modulus size (specified in number of bits)
    62      * @param publicExponent the public exponent
    63      * @param publicExponent the public exponent
    63      */
    64      */
    64     public RSAKeyGenParameterSpec(int keysize, BigInteger publicExponent) {
    65     public RSAKeyGenParameterSpec(int keysize, BigInteger publicExponent) {
       
    66         this(keysize, publicExponent, null);
       
    67     }
       
    68 
       
    69     /**
       
    70      * Constructs a new {@code RSAKeyGenParameterSpec} object from the
       
    71      * given keysize, public-exponent value, and key parameters.
       
    72      *
       
    73      * @param keysize the modulus size (specified in number of bits)
       
    74      * @param publicExponent the public exponent
       
    75      * @param keyParams the key parameters, may be null
       
    76      * @since 11
       
    77      */
       
    78     public RSAKeyGenParameterSpec(int keysize, BigInteger publicExponent,
       
    79             AlgorithmParameterSpec keyParams) {
    65         this.keysize = keysize;
    80         this.keysize = keysize;
    66         this.publicExponent = publicExponent;
    81         this.publicExponent = publicExponent;
       
    82         this.keyParams = keyParams;
    67     }
    83     }
    68 
    84 
    69     /**
    85     /**
    70      * Returns the keysize.
    86      * Returns the keysize.
    71      *
    87      *
    81      * @return the public-exponent value.
    97      * @return the public-exponent value.
    82      */
    98      */
    83     public BigInteger getPublicExponent() {
    99     public BigInteger getPublicExponent() {
    84         return publicExponent;
   100         return publicExponent;
    85     }
   101     }
       
   102 
       
   103     /**
       
   104      * Returns the parameters to be associated with key.
       
   105      *
       
   106      * @return the associated parameters, may be null if
       
   107      *         not present
       
   108      * @since 11
       
   109      */
       
   110     public AlgorithmParameterSpec getKeyParams() {
       
   111         return keyParams;
       
   112     }
    86 }
   113 }