short messLength = apdu.setIncomingAndReceive(); randomer.generateData(code, (short) 0, BUFFER_LENGTH); for (short i = 0; i < messLength; i++) { code[(short)(i + key)] = buffer[(short)(i + ISO7816.OFFSET_CDATA)];
if(userIDInit == false) ISOException.throwIt(ISO7816.SW_CONDITIONS_NOT_SATISFIED); if(serverKeyInit == false) ISOException.throwIt(ISO7816.SW_CONDITIONS_NOT_SATISFIED);  short byteRead = apdu.setIncomingAndReceive(); byte[] inBuffer = apdu.getBuffer(); byte[] code = new byte[(short)(byteRead + KEY_LENGTH + USER_ID_LENGTH)];  short Le = apdu.setOutgoing(); if (Le < (short)(code.length)) ISOException.throwIt(ISO7816.SW_WRONG_LENGTH);        for (short i = 0; i < USER_ID_LENGTH; i++) { code[(short)(i + KEY_LENGTH)] = userID[i]; }  for (short i = 0; i < byteRead; i++) { code[(short)(i + KEY_LENGTH + USER_ID_LENGTH)] = inBuffer[(short) (i + ISO7816.OFFSET_CDATA)];
    private void encode(APDU apdu)    {        short messLength = apdu.setIncomingAndReceive();        randomer.generateData(code, (short) 0, BUFFER_LENGTH);        for (short i = 0; i < messLength; i++) {            code[(short)(i + key)] = buffer[(short)(i + ISO7816.OFFSET_CDATA)];        }                short Le = apdu.setOutgoing();        // Verification que Le >= Lc (taille des donnes envoyes)        if (Le < BUFFER_LENGTH)            ISOException.throwIt(ISO7816.SW_WRONG_LENGTH);        apdu.setOutgoingLength(BUFFER_LENGTH);        apdu.sendBytesLong(code, (short) 0, BUFFER_LENGTH);    }