jdk/src/java.base/share/classes/sun/security/rsa/RSAKeyFactory.java
changeset 32649 2ee9017c7597
parent 30374 2abaf49910ea
child 37593 824750ada3d6
equal deleted inserted replaced
32648:1fa861caf840 32649:2ee9017c7597
    58  * @since   1.5
    58  * @since   1.5
    59  * @author  Andreas Sterbenz
    59  * @author  Andreas Sterbenz
    60  */
    60  */
    61 public final class RSAKeyFactory extends KeyFactorySpi {
    61 public final class RSAKeyFactory extends KeyFactorySpi {
    62 
    62 
    63     private final static Class<?> rsaPublicKeySpecClass =
    63     private static final Class<?> rsaPublicKeySpecClass =
    64                                                 RSAPublicKeySpec.class;
    64                                                 RSAPublicKeySpec.class;
    65     private final static Class<?> rsaPrivateKeySpecClass =
    65     private static final Class<?> rsaPrivateKeySpecClass =
    66                                                 RSAPrivateKeySpec.class;
    66                                                 RSAPrivateKeySpec.class;
    67     private final static Class<?> rsaPrivateCrtKeySpecClass =
    67     private static final Class<?> rsaPrivateCrtKeySpecClass =
    68                                                 RSAPrivateCrtKeySpec.class;
    68                                                 RSAPrivateCrtKeySpec.class;
    69 
    69 
    70     private final static Class<?> x509KeySpecClass  = X509EncodedKeySpec.class;
    70     private static final Class<?> x509KeySpecClass  = X509EncodedKeySpec.class;
    71     private final static Class<?> pkcs8KeySpecClass = PKCS8EncodedKeySpec.class;
    71     private static final Class<?> pkcs8KeySpecClass = PKCS8EncodedKeySpec.class;
    72 
    72 
    73     public final static int MIN_MODLEN = 512;
    73     public static final int MIN_MODLEN = 512;
    74     public final static int MAX_MODLEN = 16384;
    74     public static final int MAX_MODLEN = 16384;
    75 
    75 
    76     /*
    76     /*
    77      * If the modulus length is above this value, restrict the size of
    77      * If the modulus length is above this value, restrict the size of
    78      * the exponent to something that can be reasonably computed.  We
    78      * the exponent to something that can be reasonably computed.  We
    79      * could simply hardcode the exp len to something like 64 bits, but
    79      * could simply hardcode the exp len to something like 64 bits, but
    80      * this approach allows flexibility in case impls would like to use
    80      * this approach allows flexibility in case impls would like to use
    81      * larger module and exponent values.
    81      * larger module and exponent values.
    82      */
    82      */
    83     public final static int MAX_MODLEN_RESTRICT_EXP = 3072;
    83     public static final int MAX_MODLEN_RESTRICT_EXP = 3072;
    84     public final static int MAX_RESTRICTED_EXPLEN = 64;
    84     public static final int MAX_RESTRICTED_EXPLEN = 64;
    85 
    85 
    86     private static final boolean restrictExpLen =
    86     private static final boolean restrictExpLen =
    87         "true".equalsIgnoreCase(AccessController.doPrivileged(
    87         "true".equalsIgnoreCase(AccessController.doPrivileged(
    88             new GetPropertyAction(
    88             new GetPropertyAction(
    89                 "sun.security.rsa.restrictRSAExponent", "true")));
    89                 "sun.security.rsa.restrictRSAExponent", "true")));
    90 
    90 
    91     // instance used for static translateKey();
    91     // instance used for static translateKey();
    92     private final static RSAKeyFactory INSTANCE = new RSAKeyFactory();
    92     private static final RSAKeyFactory INSTANCE = new RSAKeyFactory();
    93 
    93 
    94     public RSAKeyFactory() {
    94     public RSAKeyFactory() {
    95         // empty
    95         // empty
    96     }
    96     }
    97 
    97