In order to thank you for all members' support of our website, we are holding new events - Getting Free Samples by Paying Freight only.
Want to get free samples? Please check this post for more details.

About generateAsymetricKey() function

Open source implementation of the OpenPGP smart card version 2.0 on a java card.

Moderator: Ellisun

bigWhite
Posts: 26
Joined: Tue Aug 25, 2015 8:21 am
Points :176
Contact:

About generateAsymetricKey() function

Post by bigWhite » Tue Dec 15, 2015 5:32 am

From the source code, generateAsymetricKey()function is to generate three types KEY pairs, and the types of key pairs are:
signatureKey, confidentialityKey and authenticationKey.

But, when I send APDU, only signatureKey (OFFSET_CDATA, is 0xB6) generated successfully, the others all returned 0x6A82.
WHY???

My sending APDU commands are:

Code: Select all

>> 00 20 00 82 06 31 32 33 34 35 36
<< 90 00

>> 00 20 00 83 08 31 32 33 34 35 36 37 38
<< 90 00

>> 00 20 00 83 08 31 32 33 34 35 36 37 38
<< 90 00

>> 80 47 81 00 01 B8
<< 6A 82   File or application not found

>> 80 47 81 00 01 B6
<< 7F 49 82 01 09 82 03 01 00 01 81 82 01 00 61 00   Response bytes remaining

>> 00 C0 00 00
<< 90 00

>> 80 47 81 00 01 A4
<< 6A 82   File or application not found


predators
Posts: 21
Joined: Wed Aug 19, 2015 7:18 am
Points :12
Contact:

Re: About generateAsymetricKey() function

Post by predators » Wed Dec 16, 2015 5:51 am

While sending APDU command, the P1 of your incoming APDU is 0x81,

Code: Select all

if (buffer[ISO7816.OFFSET_P1] == (byte) 0x81) {
      if (!(key.getPublic()).isInitialized()) {
        ISOException.throwIt(ISO7816.SW_FILE_NOT_FOUND);
      }
    }
   

From the code, it will check the KEY isInitialized(), Maybe the corresponding Key is not initialized.

And I debug this applet, after I select the applet and verify the PIN1, PIN3, I send the APDU is "8047810001 KeyTypes", no matter what key types, the response APDU are all 0x6A82.

Post Reply Previous topicNext topic

Who is online

Users browsing this forum: No registered users and 1 guest

JavaCard OS : Disclaimer