2 Replies Latest reply on Nov 20, 2012 1:14 PM by 966781

    How to save a key in RAM


      iam using two AESKeys in my Applet for encrypted communication between the card and the host.
      public class MyApplet extends Applet 
          private AESKey host_key;
          private AESKey card_key;
          public MyApplet(byte[] bArray, short bOffset, byte bLength)
              host_key = (AESKey)KeyBuilder.buildKey(KeyBuilder.TYPE_AES, KeyBuilder.LENGTH_AES_256, false);
              card_key = (AESKey)KeyBuilder.buildKey(KeyBuilder.TYPE_AES, KeyBuilder.LENGTH_AES_256, false);
              register(bArray, (short) (bOffset + 1), bArray[bOffset]);
      After some unencrypted communication and changing some data for key-building, the card builds the keys and sets them:
      host_key.setKey(key_block, (short)0);
      card_key.setKey(key_block, (short)32);
      But now, the keys are stored in the EEPROM. After a card reset the keys must not be available anymore.
      How can i save the key objects transient ?