title: Should I use Cipher.WRAP_MODE OR Cipher.ENCRYPT_MODE to encrypt a session key?
body: <p>How should I encrypt a session key on the client side with the public key transported from server side?</p>
  
  <p>Should I use <code>Cipher.WRAP_MODE</code> or <code>Cipher.ENCRYPT_MODE</code>?</p>
  
  <pre><code>Cipher cipher = Cipher.getInstance("RSA");
  cipher.init(Cipher.WRAP_MODE, publicKey);
  byte[] wrappedSessionKey = cipher.wrap(sessionKey);
  </code></pre>
  
  <p>I am not really sure how to use encrypt_mode to encrypt sessionKey. Could someone help me on this?</p>