Handle tag Algorithm Information

This commit is contained in:
Arnaud Fontaine 2019-06-17 11:57:48 +02:00
parent 1e89a26e8e
commit c67545e128
3 changed files with 22 additions and 0 deletions

View File

@ -147,4 +147,19 @@ public final class Common {
}
}
protected static final short writeAlgorithmInformation(final byte key_tag,
final byte[] buf, short off) {
for(short m = 2; m <= 4; ++m) {
for(byte form = 1; form <= 3; form += 2) {
buf[off++] = key_tag;
buf[off++] = (byte)6; /* len */
buf[off++] = (byte)0x01; /* RSA */
off = Util.setShort(buf, off, (short)(m * 1024)); /* modulus bit size */
off = Util.setShort(buf, off, (short)0x11); /* 65537 = 17 bits public exponent size */
buf[off++] = form;
}
}
return off;
}
}

View File

@ -107,6 +107,7 @@ public final class Constants {
protected static final short TAG_PRIVATE_DO_0104 = (short)0x0104;
protected static final short TAG_AES_KEY = (short)0x00d5;
protected static final short TAG_KEY_DERIVATION_FUNCTION = (short)0x00f9;
protected static final short TAG_ALGORITHM_INFORMATION = (short)0x00fa;
protected static final short CRT_AUTHENTICATION_KEY = (short)0xa400;
protected static final short CRT_SIGNATURE_KEY = (short)0xb600;

View File

@ -445,6 +445,12 @@ public final class SmartPGPApplet extends Applet {
data.key_derivation_function_length);
break;
case Constants.TAG_ALGORITHM_INFORMATION:
off = Common.writeAlgorithmInformation((byte)0xc1, buf, off); /* SIG */
off = Common.writeAlgorithmInformation((byte)0xc2, buf, off); /* DEC */
off = Common.writeAlgorithmInformation((byte)0xc3, buf, off); /* AUT */
break;
default:
ISOException.throwIt(Constants.SW_REFERENCE_DATA_NOT_FOUND);
return 0;