Forum Stats

  • 3,752,057 Users
  • 2,250,452 Discussions
  • 7,867,704 Comments

Discussions

Partial hashing

843851
843851 Member Posts: 19,484
edited Aug 14, 2009 11:45AM in Java Card
Hello

I got my hands on a card that in order to perform a Digital Signature the data has to be passed has a Partial Hash. It only supports this kind of hashing method

Well, putting it simple I do not know how to perform this.

The APDU format for the PSO where the data is passed is the following:

Cla: 0x00
INS: 0x2A - For PSO
P1: 90 - For hashing
P2: A0 - For hash calculation of the data
Data: CRT DST with the following TLV structure

0x90, 0x1C, Intermediate hash value and number of bit already hashed (coded over 8 bytes = MSB...LSB);
0x80, Var (<= 0x40); Last block, to be hashed by the card

I also do not understand how to configure this DST.

In the DST, the field with tag 0x90 is with length 28 bytes (1C). This means that is the regular 20 bytes from an hash plus 8 other bytes? What other bytes?

And also in the DST but for the tag 0x80 what is the last block?

The Google searches are not helping much, so, any tips regarding partial hashing?

Ty
Cad

Comments

  • 843851
    843851 Member Posts: 19,484
    Small errata:

    In the previous topic I called this several times by DST. This is wrong, its the *"Perform Security Operation (PSO) - HASH"* that I am trying to implement.

    And, trying to explain a litle better the problem, the card is reporting the "6A80" SW which mean error in the TLV structure in the data field.

    The TLV structure is:

    T1 || L1 || V1 || T2 || L2 || V2
    T1 = ‘90’ Intermediate hash code
    L1 = ‘1C’
    V1 = ’20 bytes intermediate hash value’ || ‘8 bytes (nb of bits already hashed)’
    T2 = ‘80’ last block
    L2 <= '40'
    V2 = Text to hash without padding

    I already tried to hash only a part of the data and concatenate it with the bit size (V1) and in the L2 and V2 I putted the length of the remaining bytes (L2) and the bytes that were not hashed (V2).

    Still the card reports 6A80...
This discussion has been closed.