Page 1 of 1

How to save the key in RAM?

Posted: Tue Mar 15, 2016 5:51 am
by Elisadl
I am trying to use two AESKeys in my Applet for encrypted communication between the card and the host.

Code: Select all

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 un-encrypted communication and changing some data for key-building, the card builds the keys and sets them:

Code: Select all

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 in RAM?

Re: How to save the key in RAM?

Posted: Sat Mar 19, 2016 2:34 am
by Heather
Check here