am d25093d2: Merge "Reject AlgorithmParameters of wrong type." into mnc-dev

* commit 'd25093d2fd151638a108a110484e579cc1dcaf54':
  Reject AlgorithmParameters of wrong type.
This commit is contained in:
Alex Klyubin
2015-07-08 19:41:07 +00:00
committed by Android Git Automerger
2 changed files with 12 additions and 0 deletions

View File

@@ -129,6 +129,12 @@ abstract class AndroidKeyStoreAuthenticatedAESCipherSpi extends AndroidKeyStoreC
return; return;
} }
if (!"GCM".equalsIgnoreCase(params.getAlgorithm())) {
throw new InvalidAlgorithmParameterException(
"Unsupported AlgorithmParameters algorithm: " + params.getAlgorithm()
+ ". Supported: GCM");
}
GCMParameterSpec spec; GCMParameterSpec spec;
try { try {
spec = params.getParameterSpec(GCMParameterSpec.class); spec = params.getParameterSpec(GCMParameterSpec.class);

View File

@@ -197,6 +197,12 @@ class AndroidKeyStoreUnauthenticatedAESCipherSpi extends AndroidKeyStoreCipherSp
return; return;
} }
if (!"AES".equalsIgnoreCase(params.getAlgorithm())) {
throw new InvalidAlgorithmParameterException(
"Unsupported AlgorithmParameters algorithm: " + params.getAlgorithm()
+ ". Supported: AES");
}
IvParameterSpec ivSpec; IvParameterSpec ivSpec;
try { try {
ivSpec = params.getParameterSpec(IvParameterSpec.class); ivSpec = params.getParameterSpec(IvParameterSpec.class);