summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Vartanian <flooey@google.com>2017-03-29 15:14:10 +0100
committerAdam Vartanian <flooey@google.com>2017-03-29 15:14:10 +0100
commit07e660219caac9bf288ffb6b101606ba6efe8184 (patch)
tree15e408fbab64401b8e4da69b594e1b4d3275596d
parent6feb860f988cd848595782946fd16d6b536d3fb8 (diff)
downloadbouncycastle-07e660219caac9bf288ffb6b101606ba6efe8184.tar.gz
Remove an Android change that is causing a test to fail
We have a patch in KeyAgreementSpi that changes the set of exceptions that are caught from within Bouncy Castle from Exception to only IllegalStateException. This patch was introduced in the upgrade to BC 1.56, and there's no explanation why it was introduced. Prior to that upgrade, upstream caught no exceptions and we caught IllegalStateException. (See aosp/318406.) This shouldn't cause any problems for users, as the set of exceptions that is thrown by the internal key agreement class is an implementation detail and InvalidKeyException and IllegalStateException are the only documented exceptions thrown from KeyAgreement#doPhase() (which is the public API this backs), so any other exception type would be unexpected anyway. Bug: 36712087 Test: cts -m CtsLibcoreTestCases Change-Id: Idb18fe0cf7bcf5a86e8805c362941528249aad2a
-rw-r--r--bcprov/src/main/java/org/bouncycastle/jcajce/provider/asymmetric/ec/KeyAgreementSpi.java22
1 files changed, 8 insertions, 14 deletions
diff --git a/bcprov/src/main/java/org/bouncycastle/jcajce/provider/asymmetric/ec/KeyAgreementSpi.java b/bcprov/src/main/java/org/bouncycastle/jcajce/provider/asymmetric/ec/KeyAgreementSpi.java
index 5d8e6b18..6e1eda2d 100644
--- a/bcprov/src/main/java/org/bouncycastle/jcajce/provider/asymmetric/ec/KeyAgreementSpi.java
+++ b/bcprov/src/main/java/org/bouncycastle/jcajce/provider/asymmetric/ec/KeyAgreementSpi.java
@@ -133,20 +133,14 @@ public class KeyAgreementSpi
try
{
result = agreement.calculateAgreement(pubKey);
- // BEGIN android-changed
- // Was:
- // } catch (final Exception e) {
- // throw new InvalidKeyException("calculation failed: " + e.getMessage())
- // {
- // public Throwable getCause()
- // {
- // return e;
- // }
- // };
- // }
- // END android-changed
- } catch (IllegalStateException e) {
- throw new InvalidKeyException("Invalid public key");
+ } catch (final Exception e) {
+ throw new InvalidKeyException("calculation failed: " + e.getMessage())
+ {
+ public Throwable getCause()
+ {
+ return e;
+ }
+ };
}
return null;
}