2 Replies Latest reply: Mar 7, 2013 9:49 AM by 807105 RSS

    Maximum TDES length data to cipher

    807105
      Hi,

      I have been testing with the creation of TDES keys, and using to cipher data, and with the results I'm receiving i'm wondering If there is any limit on TripleDes with the length of the data to cipher because I'm only able to cipher data from 8,16 bytes, up to 32 it returns me an 6F00 error also doing a try catch:
      cipher= Cipher.getInstance(Cipher.ALG_DES_CBC_NOPAD,false);
      cipher.init(des,Cipher.MODE_DECRYPT,new byte[]{0,0,0,0,0,0,0,0},(short)0,(short)8);
           try{
                     cipheredataL=cipher.doFinal(data2cipher,(short)0, (short)32, randomD_cipher, (short)0);
           }catch(CryptoException crypto){
                if (crypto.getReason() == CryptoException.UNINITIALIZED_KEY)
                          ISOException.throwIt(ISO7816.SW_FILE_FULL);
                     else if (crypto.getReason() == CryptoException.INVALID_INIT)
                          ISOException.throwIt(ISO7816.SW_FILE_NOT_FOUND);
                     else if (crypto.getReason() == CryptoException.ILLEGAL_USE)
                          ISOException.throwIt(ISO7816.SW_FILE_INVALID);
                     else
                          ISOException.throwIt(ISO7816.SW_RECORD_NOT_FOUND);
           }

      Thanks for your help another time :)