diff options
author | Prashant Patil <patilprashant@google.com> | 2023-08-03 00:35:48 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2023-08-03 00:35:48 +0000 |
commit | 8b45ed5019e871bc909ba7577e08e12eaba8f585 (patch) | |
tree | 6c27c35cdc15755e25b03ba52723dc5f73b408c1 | |
parent | a2f2be6ed1af3df2fb6846dc542fffa8010ee6e4 (diff) | |
parent | 4ae6fe0f1371e5b9c57890e915ed6242a55bd0f0 (diff) | |
download | wycheproof-8b45ed5019e871bc909ba7577e08e12eaba8f585.tar.gz |
Avoid duplicate entry of digest am: d89919bab7 am: 4ae6fe0f13
Original change: https://googleplex-android-review.googlesource.com/c/platform/external/wycheproof/+/24249204
Change-Id: I6126e2123740aeba6889f2fc409c1157edbc4e7d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r-- | keystore-cts/java/com/google/security/wycheproof/testcases/RsaOaepTest.java | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/keystore-cts/java/com/google/security/wycheproof/testcases/RsaOaepTest.java b/keystore-cts/java/com/google/security/wycheproof/testcases/RsaOaepTest.java index 0a82423..9c2cbf5 100644 --- a/keystore-cts/java/com/google/security/wycheproof/testcases/RsaOaepTest.java +++ b/keystore-cts/java/com/google/security/wycheproof/testcases/RsaOaepTest.java @@ -60,17 +60,20 @@ public class RsaOaepTest { private static PrivateKey saveKeyPairToKeystoreAndReturnPrivateKey(PublicKey pubKey, PrivateKey privKey, String digest, String mgfDigest, boolean isStrongBox) throws Exception { + KeyProtection.Builder keyProtection = new KeyProtection.Builder(KeyProperties.PURPOSE_SIGN | + KeyProperties.PURPOSE_VERIFY | + KeyProperties.PURPOSE_ENCRYPT | + KeyProperties.PURPOSE_DECRYPT) + .setEncryptionPaddings(KeyProperties.ENCRYPTION_PADDING_RSA_PKCS1, + KeyProperties.ENCRYPTION_PADDING_RSA_OAEP) + .setIsStrongBoxBacked(isStrongBox); + if (digest.equalsIgnoreCase(mgfDigest)) { + keyProtection.setDigests(digest); + } else { + keyProtection.setDigests(digest, mgfDigest); + } return (PrivateKey) KeyStoreUtil.saveKeysToKeystore(KEY_ALIAS_1, pubKey, privKey, - new KeyProtection.Builder(KeyProperties.PURPOSE_SIGN | - KeyProperties.PURPOSE_VERIFY | - KeyProperties.PURPOSE_ENCRYPT | - KeyProperties.PURPOSE_DECRYPT) - .setEncryptionPaddings(KeyProperties.ENCRYPTION_PADDING_RSA_PKCS1, - KeyProperties.ENCRYPTION_PADDING_RSA_OAEP) - .setDigests(digest, mgfDigest) - .setIsStrongBoxBacked(isStrongBox) - .build()) - .getKey(KEY_ALIAS_1, null); + keyProtection.build()).getKey(KEY_ALIAS_1, null); } /** |