aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPrashant Patil <patilprashant@google.com>2023-08-02 23:49:49 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2023-08-02 23:49:49 +0000
commit4ae6fe0f1371e5b9c57890e915ed6242a55bd0f0 (patch)
tree6c27c35cdc15755e25b03ba52723dc5f73b408c1
parent6a11d9cc9f67c1d8dc9ffb99326d747324cb8baf (diff)
parentd89919bab7a444fd2fc1cb7f60b7e8eaee289ead (diff)
downloadwycheproof-4ae6fe0f1371e5b9c57890e915ed6242a55bd0f0.tar.gz
Avoid duplicate entry of digest am: d89919bab7
Original change: https://googleplex-android-review.googlesource.com/c/platform/external/wycheproof/+/24249204 Change-Id: Ibb41b67b991720e55896f6e9dc772ad99dcb60f8 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.java23
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);
}
/**