Skip to content

Commit

Permalink
NeoPGPApplet: rework historicalBytes
Browse files Browse the repository at this point in the history
Break the bytes down into individual bits and don't report the extended
length capability if we don't provide our own buffer. We don't need it
then.

Signed-off-by: Michael Walle <[email protected]>
  • Loading branch information
mwalle committed Mar 17, 2024
1 parent 53f3e0a commit d9114f8
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/cc/walle/neopgp/NeoPGPApplet.java
Original file line number Diff line number Diff line change
Expand Up @@ -408,15 +408,29 @@ public void process(APDU apdu) {
}

private short getHistoricalBytes(byte[] buf, short off) {
byte tmp;

buf[off++] = (byte)0x00;

/* cTLV 0x73 */
buf[off++] = (byte)0x73;
buf[off++] = (byte)0x00;
buf[off++] = (byte)0x00;
buf[off++] = (byte)0x60;

tmp = (byte)(0 << 7) | /* Command chaining supported */
(byte)(0 << 5) | /* Extended length info in EF.ATR */
(byte)(0 << 3) | /* Logical channel number */
(byte)(0 << 0); /* Maximal logical channels */

/* Extended length supported */
if (tmpBuffer != null)
tmp |= (byte)(1 << 6);
buf[off++] = tmp;

/* cTLV 0x31 */
buf[off++] = (byte)0x31;
buf[off++] = (byte)0xde;

/* LCS */
if (cardTerminated)
buf[off++] = (byte)0x03;
Expand Down

0 comments on commit d9114f8

Please sign in to comment.