Input data must have a multiple of 8 for decryption.
input='112233....BB' -> 11 bytes
after ISO9797_M2 padding='112233....BB8000000000' -> 16 bytes
after encryption='xxxx...xx' -> 16 bytes
So if you want to get correctly decrypted value, you have to give 16 bytes of encrypted data.
Search found 31 matches: re:
Searched query: re
- Mon Oct 16, 2017 4:55 am
- Forum: Questions & Answers
- Topic: SW_ILLEGAL_USE returned by cipher.dofinal()
- Replies: 3
- Views: 8537
- Mon Aug 21, 2017 5:13 am
- Forum: Questions & Answers
- Topic: Issue about generating 2048 bytes keys with RSA
- Replies: 2
- Views: 7432
Re: Issue about generating 2048 bytes keys with RSA
A status word of 0x6F00 is an Unknown Error.
You could try inserting debug code to see what line of code is failing. Add the following line of code near the start and keep moving/redploying and see when you start getting 6F00 instead of 1234.
You could try inserting debug code to see what line of code is failing. Add the following line of code near the start and keep moving/redploying and see when you start getting 6F00 instead of 1234.
Code: Select all
ISOException.throwIt((short)0x1234);
- Mon Jul 24, 2017 11:12 pm
- Forum: Questions & Answers
- Topic: Generate random number
- Replies: 1
- Views: 6223
Re: Generate random number
If you remove the setSeeed call, you will get a different result from the random number generator, since you are seeding the generator with the same value.
- Mon Jun 19, 2017 2:11 am
- Forum: Questions & Answers
- Topic: How to send int
- Replies: 1
- Views: 5768
Re: How to send int
You can convert int to byte[] to solve your problem.
To convert an int to a byte array, keep in mind that an int is 4 bytes. Then this is a straight Java problem that is not specific to Java Card.
To convert an int to a byte array, keep in mind that an int is 4 bytes. Then this is a straight Java problem that is not specific to Java Card.
- Mon May 08, 2017 5:56 am
- Forum: Questions & Answers
- Topic: JCOP card chip speed
- Replies: 3
- Views: 8114
Re: JCOP card chip speed
I check it from the JCOP datasheet. If the card you bought is J3D081 from this online store. In contact mode, the following communication speeds are supported: - 9600 bit/s [Default] - 19200 bit/s - 38400 bit/s - 57600 bit/s - 115200 bit/s - 223200 bit/s In contactless mode,the following communicati...
- Fri Mar 10, 2017 1:19 am
- Forum: Questions & Answers
- Topic: Specify the right interface for my code
- Replies: 2
- Views: 6946
Re: Specify the right interface for my code
Maybe this code helps: byte protocolMedia = (byte) (apdu.getProtocol() & APDU.PROTOCOL_MEDIA_MASK); if ((protocolMedia == APDU.PROTOCOL_MEDIA_CONTACTLESS_TYPE_A) || (protocolMedia == APDU.PROTOCOL_MEDIA_CONTACTLESS_TYPE_B)) { // Contactless interface; switch (buf[ISO7816.OFFSET_INS]) { case INS_...
- Fri Feb 10, 2017 6:17 am
- Forum: Questions & Answers
- Topic: DES decryption implementation in java and java card
- Replies: 3
- Views: 7606
Re: DES decryption implementation in java and java card
IMO, there is no advantage or dis-advantage in this case. You should not rely on intermediate results of update anyway because the operation is not completed until doFinal(...) method is called.
- Fri Feb 10, 2017 3:15 am
- Forum: Questions & Answers
- Topic: DES decryption implementation in java and java card
- Replies: 3
- Views: 7606
Re: DES decryption implementation in java and java card
mose05 wrote:- In java, it need to have at least 16 bytes input to have output data.
Have you got 8 bytes in the response? If you have 8 bytes only, you should call doFinal().
- Tue Jan 31, 2017 2:49 am
- Forum: Questions & Answers
- Topic: secure channel initiation mode implicit
- Replies: 4
- Views: 8996
Re: secure channel initiation mode implicit
I am glad to be of assistance.
- Mon Jan 30, 2017 9:18 am
- Forum: Questions & Answers
- Topic: secure channel initiation mode implicit
- Replies: 4
- Views: 8996
Re: secure channel initiation mode implicit
The steps are much the same as the explicit, except there is not INIT-UPDATE/EXT-AUTH commands to deal with. When the first secured APDU is received (CLA = 0x84), you follow the process to generate session keys and verify the MAC. The card spec outlines how to generate a MAC with the session keys.