1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one or more 3 * contributor license agreements. See the NOTICE file distributed with 4 * this work for additional information regarding copyright ownership. 5 * The ASF licenses this file to You under the Apache License, Version 2.0 6 * (the "License"); you may not use this file except in compliance with 7 * the License. You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 18 package java.security.spec; 19 20 import java.math.BigInteger; 21 22 /** 23 * The parameter specification for generating an RSA key pair. 24 */ 25 public class RSAKeyGenParameterSpec implements AlgorithmParameterSpec { 26 27 /** 28 * The value of the public exponent {@code F0} = 3. 29 */ 30 public static final BigInteger F0 = BigInteger.valueOf(3L); 31 32 /** 33 * The value of the public exponent {@code F4} = 65537. 34 */ 35 public static final BigInteger F4 = BigInteger.valueOf(65537L); 36 37 // Key size 38 private final int keysize; 39 // Public Exponent 40 private final BigInteger publicExponent; 41 42 /** 43 * Creates a new {@code RSAKeyGenParameterSpec} with the specified key size 44 * and public exponent. 45 * 46 * @param keysize 47 * the size of the modulus (number of bits). 48 * @param publicExponent 49 * the value of the public exponent. 50 */ 51 public RSAKeyGenParameterSpec(int keysize, BigInteger publicExponent) { 52 this.keysize = keysize; 53 this.publicExponent = publicExponent; 54 } 55 56 /** 57 * Returns the size of the modulus (number of bits). 58 * 59 * @return the size of the modulus (number of bits). 60 */ 61 public int getKeysize() { 62 return keysize; 63 } 64 65 /** 66 * Returns the value of the public exponent. 67 * 68 * @return the value of the public exponent. 69 */ 70 public BigInteger getPublicExponent() { 71 return publicExponent; 72 } 73 } 74