diff options
author | Alex Klyubin <klyubin@google.com> | 2015-07-08 19:32:02 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-07-08 19:32:32 +0000 |
commit | d25093d2fd151638a108a110484e579cc1dcaf54 (patch) | |
tree | d146d9a6adeefb7d7d1044285b50aa3bd21f5178 /keystore | |
parent | 3aa1b1e5ec3a4e2074ea054b931cd68df45b43cf (diff) | |
parent | 5c38e7918aea36ee8f516793d5641b05a8de710e (diff) | |
download | frameworks_base-d25093d2fd151638a108a110484e579cc1dcaf54.zip frameworks_base-d25093d2fd151638a108a110484e579cc1dcaf54.tar.gz frameworks_base-d25093d2fd151638a108a110484e579cc1dcaf54.tar.bz2 |
Merge "Reject AlgorithmParameters of wrong type." into mnc-dev
Diffstat (limited to 'keystore')
-rw-r--r-- | keystore/java/android/security/keystore/AndroidKeyStoreAuthenticatedAESCipherSpi.java | 6 | ||||
-rw-r--r-- | keystore/java/android/security/keystore/AndroidKeyStoreUnauthenticatedAESCipherSpi.java | 6 |
2 files changed, 12 insertions, 0 deletions
diff --git a/keystore/java/android/security/keystore/AndroidKeyStoreAuthenticatedAESCipherSpi.java b/keystore/java/android/security/keystore/AndroidKeyStoreAuthenticatedAESCipherSpi.java index 6411066..5459bea 100644 --- a/keystore/java/android/security/keystore/AndroidKeyStoreAuthenticatedAESCipherSpi.java +++ b/keystore/java/android/security/keystore/AndroidKeyStoreAuthenticatedAESCipherSpi.java @@ -129,6 +129,12 @@ abstract class AndroidKeyStoreAuthenticatedAESCipherSpi extends AndroidKeyStoreC return; } + if (!"GCM".equalsIgnoreCase(params.getAlgorithm())) { + throw new InvalidAlgorithmParameterException( + "Unsupported AlgorithmParameters algorithm: " + params.getAlgorithm() + + ". Supported: GCM"); + } + GCMParameterSpec spec; try { spec = params.getParameterSpec(GCMParameterSpec.class); diff --git a/keystore/java/android/security/keystore/AndroidKeyStoreUnauthenticatedAESCipherSpi.java b/keystore/java/android/security/keystore/AndroidKeyStoreUnauthenticatedAESCipherSpi.java index 486519c..1f1d36f 100644 --- a/keystore/java/android/security/keystore/AndroidKeyStoreUnauthenticatedAESCipherSpi.java +++ b/keystore/java/android/security/keystore/AndroidKeyStoreUnauthenticatedAESCipherSpi.java @@ -197,6 +197,12 @@ class AndroidKeyStoreUnauthenticatedAESCipherSpi extends AndroidKeyStoreCipherSp return; } + if (!"AES".equalsIgnoreCase(params.getAlgorithm())) { + throw new InvalidAlgorithmParameterException( + "Unsupported AlgorithmParameters algorithm: " + params.getAlgorithm() + + ". Supported: AES"); + } + IvParameterSpec ivSpec; try { ivSpec = params.getParameterSpec(IvParameterSpec.class); |