Forum Replies Created
-
Re: Reply To: Exception "Incomplete response" when trying to debit or credit value
3. January 2017 at 15:20 in reply to: Exception "Incomplete response" when trying to debit or credit valueI just randomly upgraded AAR to 1.1 and everything works now. So there's that.
+ 0 | - 0
Re: Reply To: Exception "Incomplete response" when trying to debit or credit value
8. December 2016 at 10:45 in reply to: Exception "Incomplete response" when trying to debit or credit valueHello.
Our key is 3K3DES, not 2K3DES. I've tried it with key type to THREEDES and it throws Authentication Error.
+ 0 | - 0
Re: Reply To: Exception "Incomplete response" when trying to debit or credit value
6. December 2016 at 13:41 in reply to: Exception "Incomplete response" when trying to debit or credit valueEverything is the same with our code, except that we use 3K3DES instead of AES. Would you be able to test with that key type?
Key key = new SecretKeySpec( pbyDiversifiedKey, "DESede" );
KeyData keyData = new KeyData();
keyData.setKey( key );
m_objDESFireEV1.authenticate(cardKeyNumber, IDESFireEV1.AuthType.ISO, KeyType.THREE_KEY_THREEDES, keyData);
int value = m_objDESFireEV1.getValue( fileId, IDESFireEV1.CommunicationType.Enciphered);
m_objDESFireEV1.debit( fileId, value, IDESFireEV1.CommunicationType.Enciphered);
m_objDESFireEV1.commitTransaction();
m_objDESFireEV1.credit( fileId, value, IDESFireEV1.CommunicationType.Enciphered);
m_objDESFireEV1.commitTransaction();
+ 0 | - 0
Re: Reply To: Exception "Incomplete response" when trying to debit or credit value
5. December 2016 at 19:47 in reply to: Exception "Incomplete response" when trying to debit or credit valueHello again.
I've found the problem, but I'm not sure if it's on our side, or if it's something with the SDK. I have to change file settings for ReadAccess, ReadWriteAccess and WriteAccess to free access (0xE). Like this:
DESFireFile.FileSettings newSettings = new DESFireFile.FileSettings(
DESFireFile.FileType.Value,
IDESFireEV1.CommunicationType.Enciphered,
(byte) 0xE, // readAccess
(byte) 0xE, // readWriteAccess
(byte) 0xE, // writeAccess
(byte) 0xE); // changeAccess
GetValue, debit and credit now works, but only if I set CommunicationType to Plain. It doesn't work with Enciphered even though if declared so that it should.
When I change it back to 0x01 (authentication required with the key number for read access) it works like I've described in the first post.
DESFireFile.FileSettings newSettings = new DESFireFile.FileSettings(
DESFireFile.FileType.Value,
IDESFireEV1.CommunicationType.Enciphered,
(byte) 0x01, // readAccess
(byte) 0x01, // readWriteAccess
(byte) 0x01, // writeAccess
(byte) 0xE); // changeAccess
This should be working, but for some reason it's throwing an exception when trying write onto the card (as said, getting value works). Is there any chance there would be a problem with the SDK?
+ 0 | - 0
Re: Reply To: Exception "Incomplete response" when trying to debit or credit value
2. December 2016 at 8:31 in reply to: Exception "Incomplete response" when trying to debit or credit valueHi Samuel,
Thanks for the extensive explanation of possible error causers!
Here's the code:
case DESFireEV1:
m_objDESFireEV1 = DESFireFactory.getInstance()
.getDESFire(m_libInstance.getCustomModules());
try{
m_objDESFireEV1.getReader().connect();
byte[] cardUid = m_objDESFireEV1.getUID();
m_objDESFireEV1.selectApplication( rootApplicationLevel );
m_objDESFireEV1.authenticate(cardKeyNumber, authType, keyType, keyData);
// Authentication one successful
m_objDESFireEV1.selectApplication( applicationLevel );
m_objDESFireEV1.authenticate(cardKeyNumber2, authType2, keyType2, keyData2);
// Authentication two successful
m_objDESFireEV1.getValue(fileId, communicationType);
// Successfully obtained value
m_objDESFireEV1.debit(fileId, value, ourCommunicationType);
// EXCEPTION: "Incomplete response"
m_objDESFireEV1.credit(fileId, value, ourCommunicationType);
// EXCEPTION: "Incomplete response"
}catch(Throwable t){
t.printStackTrace();
}
break;
As said, thanks for the help! At least now I have a pointer where to start debugging.
+ 0 | - 0
-
AuthorPosts
Viewing 5 posts - 1 through 5 (of 5 total)