title: Using a single Cipher object or two different objects for decrypt and encrypt operations?
body: <p>As you know, when we want to do cryptography operations using Java Cards, we must use <code>Cipher</code> objects. The question that I have is actually efficiency related. Let assume that I want to do some <em>Encryption</em> and <em>Decryption</em> operations using an AES key. </p>
  
  <p>Which one of the following strategies is better? </p>
  
  <ol>
  <li>Defining two different <code>Cipher</code> objects and initial them with a single key, but different modes (<code>MODE_ENCRYPT</code> and <code>MODE_DECRYPT</code>). Then for each operation I only need to call <code>doFinal()</code> method on the proper object.</li>
  <li>Defining a single <code>Cipher</code> object and each time before calling <code>doFinal()</code> method do an <code>init()</code> method call on the object with proper mode. </li>
  </ol>