Throw exception :6982 when returning encrypted data
Posted: Mon Nov 30, 2015 3:29 am
I need to use SecureChannel.encryptData() function to encrypt data. I want Global Platform to encrypt data and later I will decrypt it with the correct session key.
The code below is to encrypt the APDU buffer, which expected a response APDU with encrypted 20.
But this returns an error SW 6982, which means "security condition not satisfied".
Where did I make mistakes? Any help is thankful.
The code below is to encrypt the APDU buffer, which expected a response APDU with encrypted 20.
Code: Select all
byte buffer = apdu.getBuffer();
buffer[0] = 20;
short lc = chan.encryptData(buffer, (short) 0, (short) 1);
apdu.setOutgoingAndSend((short) 0, lc);
But this returns an error SW 6982, which means "security condition not satisfied".
Where did I make mistakes? Any help is thankful.