summaryrefslogtreecommitdiff
path: root/keystore/java/android/security/KeyStore.java
diff options
context:
space:
mode:
authorJanis Danisevskis <jdanis@google.com>2018-11-15 09:27:16 -0800
committerJanis Danisevskis <jdanis@google.com>2018-11-15 14:58:03 -0800
commit2b106adaf527be89a5b28f05c98907dc71c9e25a (patch)
tree7c1efea865a1c1058462d7620467e125f125d9c1 /keystore/java/android/security/KeyStore.java
parent082bf0ccca33c986008071116c5fd07ec38b850b (diff)
Fix IllegalArgumentException in KeyChain
The legacy support importKey method uses the wrong method to add date fields to the import keymaster arguments. Bug: 119549023 Change-Id: Iff841086f6616303b365ad28aae429ccae1f3406
Diffstat (limited to 'keystore/java/android/security/KeyStore.java')
-rw-r--r--keystore/java/android/security/KeyStore.java9
1 files changed, 4 insertions, 5 deletions
diff --git a/keystore/java/android/security/KeyStore.java b/keystore/java/android/security/KeyStore.java
index 40570c1083b3..e1c1138fe52d 100644
--- a/keystore/java/android/security/KeyStore.java
+++ b/keystore/java/android/security/KeyStore.java
@@ -55,6 +55,7 @@ import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.security.InvalidKeyException;
import java.util.Arrays;
+import java.util.Date;
import java.util.List;
import java.util.Locale;
import java.util.concurrent.CompletableFuture;
@@ -688,11 +689,9 @@ public class KeyStore {
args.addEnum(KeymasterDefs.KM_TAG_DIGEST, KeymasterDefs.KM_DIGEST_SHA_2_384);
args.addEnum(KeymasterDefs.KM_TAG_DIGEST, KeymasterDefs.KM_DIGEST_SHA_2_512);
args.addBoolean(KeymasterDefs.KM_TAG_NO_AUTH_REQUIRED);
- args.addUnsignedLong(KeymasterDefs.KM_TAG_ORIGINATION_EXPIRE_DATETIME,
- KeymasterArguments.UINT64_MAX_VALUE);
- args.addUnsignedLong(KeymasterDefs.KM_TAG_USAGE_EXPIRE_DATETIME,
- KeymasterArguments.UINT64_MAX_VALUE);
- args.addUnsignedLong(KeymasterDefs.KM_TAG_ACTIVE_DATETIME, BigInteger.ZERO);
+ args.addDate(KeymasterDefs.KM_TAG_ORIGINATION_EXPIRE_DATETIME, new Date(Long.MAX_VALUE));
+ args.addDate(KeymasterDefs.KM_TAG_USAGE_EXPIRE_DATETIME, new Date(Long.MAX_VALUE));
+ args.addDate(KeymasterDefs.KM_TAG_ACTIVE_DATETIME, new Date(0));
return args;
}