Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line numberDiff line numberDiff line change
Expand Up@@ -245,8 +245,8 @@ private KMAttestationCert uniqueId(short obj) {
@Override
public KMAttestationCert notBefore(short obj, boolean derEncoded, byte[] scratchpad) {
if (!derEncoded) {
// convert milliseconds to UTC date
indexes[NOT_BEFORE] = KMUtils.convertToDate(obj, scratchpad, true);
// convert milliseconds to UTC / Generalized time format
indexes[NOT_BEFORE] = KMUtils.convertToDate(obj, scratchpad);
} else {
indexes[NOT_BEFORE] =
KMByteBlob.instance(
Expand All@@ -262,17 +262,8 @@ public KMAttestationCert notAfter(
short usageExpiryTimeObj, boolean derEncoded, byte[] scratchPad) {
if (!derEncoded) {
if (usageExpiryTimeObj != KMType.INVALID_VALUE) {
// compare if the expiry time is greater then 2050 then use generalized
// time format else use utc time format.
short tmpVar = KMInteger.uint_64(KMUtils.firstJan2050, (short) 0);
if (KMInteger.compare(usageExpiryTimeObj, tmpVar) >= 0) {
usageExpiryTimeObj = KMUtils.convertToDate(usageExpiryTimeObj, scratchPad, false);
} else {
usageExpiryTimeObj = KMUtils.convertToDate(usageExpiryTimeObj, scratchPad, true);
}
indexes[NOT_AFTER] = usageExpiryTimeObj;
} else {
// notAfter = certExpirtyTimeObj;
// convert milliseconds to UTC / Generalized time format
indexes[NOT_AFTER] = KMUtils.convertToDate(usageExpiryTimeObj, scratchPad);
}
} else {
indexes[NOT_AFTER] = usageExpiryTimeObj;
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -27,6 +27,5 @@ public class KMConfigurations {
// If the size of the attestation ids is known and lesser than 64
// then reduce the size here. It reduces the heap memory usage.
public static final byte MAX_ATTESTATION_IDS_SIZE = 64;
// DER subject max length.
public static final short MAX_SUBJECT_DER_LEN = 1095;
}
284 changes: 136 additions & 148 deletions Applet/AndroidSEProvider/src/com/android/javacard/keymaster/KMUtils.java

Large diffs are not rendered by default.

Original file line numberDiff line numberDiff line change
Expand Up@@ -256,8 +256,8 @@ private KMAttestationCert uniqueId(short obj) {
@Override
public KMAttestationCert notBefore(short obj, boolean derEncoded, byte[] scratchpad) {
if (!derEncoded) {
// convert milliseconds to UTC date
indexes[NOT_BEFORE] = KMUtils.convertToDate(obj, scratchpad, true);
// convert milliseconds to UTC / Generalized time format
indexes[NOT_BEFORE] = KMUtils.convertToDate(obj, scratchpad);
} else {
indexes[NOT_BEFORE] =
KMByteBlob.instance(
Expand All@@ -273,17 +273,8 @@ public KMAttestationCert notAfter(
short usageExpiryTimeObj, boolean derEncoded, byte[] scratchPad) {
if (!derEncoded) {
if (usageExpiryTimeObj != KMType.INVALID_VALUE) {
// compare if the expiry time is greater then 2050 then use generalized
// time format else use utc time format.
short tmpVar = KMInteger.uint_64(KMUtils.firstJan2050, (short) 0);
if (KMInteger.compare(usageExpiryTimeObj, tmpVar) >= 0) {
usageExpiryTimeObj = KMUtils.convertToDate(usageExpiryTimeObj, scratchPad, false);
} else {
usageExpiryTimeObj = KMUtils.convertToDate(usageExpiryTimeObj, scratchPad, true);
}
indexes[NOT_AFTER] = usageExpiryTimeObj;
} else {
// notAfter = certExpirtyTimeObj;
// convert milliseconds to UTC / Generalized time format
indexes[NOT_AFTER] = KMUtils.convertToDate(usageExpiryTimeObj, scratchPad);
}
} else {
indexes[NOT_AFTER] = usageExpiryTimeObj;
Expand Down
Loading