Hello folks,
I manage to perform authentication to G&D expert3.0 cards (Init-update, then Ext-Auth) to start a secure channel.
My problem is for following commands in same session, I get an 0x6982 for commands sent in a secure channel, below is a piece of code :
applet:
public boolean select()
{
mySecureChannel = GPSystem.getSecureChannel();
return true;
}
(...)
public void process(APDU apdu) throws ISOException
{
byte[] buffer = apdu.getBuffer();
(....)
switch (buffer[ISO7816.OFFSET_INS]) {
case myFunction:
// Host has to be authenticated:
if(mySecureChannel.getSecurityLevel() == SecureChannel.NO_SECURITY_LEVEL)
ISOException.throwIt(ISO7816.SW_CONDITIONS_NOT_SATISFIED);
else
{
wrappedLength = apdu.setIncomingAndReceive();
mySecureChannel.unwrap(buffer,ISO7816.OFFSET_CLA,(short)(wrappedLength + 5)); /*<-- Exception thrown HERE*/
myFunction(apdu); }
(...)
I assume MAC generation on host side is correct as I could reproduce sample sequences and MAC for External Authentication is correct.
Any hints greatly appreciated ! Thanks,
Daniel