title: Generating RSA key with public exponent other than 65537 (0x10001 in hex)
body: <p>I'm implementing a java card applet for 2048-bit RSA. I want to know how to create RSA key pair with a public exponent(e) other than 65537.</p>
  
  <p>The card generates RSA key pair, and return its public exponent(e) and modulus(n). But the public exponent is 65537(0x10001 in hex) every time. My code is as follows</p>
  
  <pre><code>// Initialize objects for RSA Keys and Pair
  objRSAPriKey = (RSAPrivateCrtKey)KeyBuilder.buildKey(KeyBuilder.TYPE_RSA_CRT_PRIVATE, KeyBuilder.LENGTH_RSA_2048, false);
  objRSAPubKey = (RSAPublicKey)KeyBuilder.buildKey(KeyBuilder.TYPE_RSA_PUBLIC,  KeyBuilder.LENGTH_RSA_2048, false);
  objRSAKeyPair= new KeyPair(KeyPair.ALG_RSA_CRT, KeyBuilder.LENGTH_RSA_2048);
  
      ...
  
  // Generate Key Pairs    
  objRSAKeyPair.genKeyPair();
  
  objRSAPriKey = (RSAPrivateCrtKey)objRSAKeyPair.getPrivate();
  objRSAPubKey = (RSAPublicKey)objRSAKeyPair.getPublic();
  
  GetResLen = objRSAPubKey.getModulus(Rb_GetRes, BAS);
  GetResLen += objRSAPubKey.getExponent(Rb_GetRes, GetResLen);
  </code></pre>
  
  <p>Of course, I know that these keys is different, because the other values of key (n, d, p, q) are different every time the applet generates key. But I want to know how to generate RSA key pair with public exponent of 2048-bit size</p>
  
  <p>Thanks.</p>