summaryrefslogtreecommitdiffstats
path: root/bcprov/src/main/java/org/bouncycastle/jce/spec/MQVPrivateKeySpec.java
diff options
context:
space:
mode:
authorSergio Giro <sgiro@google.com>2016-02-01 14:37:23 +0000
committerSergio Giro <sgiro@google.com>2016-02-01 15:16:12 +0000
commit397d32894b89b506dc318e0f83446187c9b76ebe (patch)
tree8229ff72c8cbb06f49dce3a8382930919fa6fc2b /bcprov/src/main/java/org/bouncycastle/jce/spec/MQVPrivateKeySpec.java
parent9b30eb05e5be69d51881a0d1b31e503e97acd784 (diff)
parent6d876f3f0ae553704a1dcf7e89003fcf14717037 (diff)
downloadandroid_external_bouncycastle-397d32894b89b506dc318e0f83446187c9b76ebe.tar.gz
android_external_bouncycastle-397d32894b89b506dc318e0f83446187c9b76ebe.tar.bz2
android_external_bouncycastle-397d32894b89b506dc318e0f83446187c9b76ebe.zip
Merge remote-tracking branch 'aosp/upstream-master' into merge-152-from-upstream
As to set a common ancestor for future merges from aosp/upstream-master (when updating to new versions of bouncycastle). We'll override all the changes of this commit with patch https://android-review.googlesource.com/#/c/199872 Change-Id: I53a7f797b520a6e119878dbae53246cdcc585ddf
Diffstat (limited to 'bcprov/src/main/java/org/bouncycastle/jce/spec/MQVPrivateKeySpec.java')
-rw-r--r--bcprov/src/main/java/org/bouncycastle/jce/spec/MQVPrivateKeySpec.java93
1 files changed, 93 insertions, 0 deletions
diff --git a/bcprov/src/main/java/org/bouncycastle/jce/spec/MQVPrivateKeySpec.java b/bcprov/src/main/java/org/bouncycastle/jce/spec/MQVPrivateKeySpec.java
new file mode 100644
index 0000000..bdd988d
--- /dev/null
+++ b/bcprov/src/main/java/org/bouncycastle/jce/spec/MQVPrivateKeySpec.java
@@ -0,0 +1,93 @@
+package org.bouncycastle.jce.spec;
+
+import java.security.PrivateKey;
+import java.security.PublicKey;
+import java.security.spec.KeySpec;
+
+import org.bouncycastle.jce.interfaces.MQVPrivateKey;
+
+/**
+ * Static/ephemeral private key (pair) for use with ECMQV key agreement
+ * (Optionally provides the ephemeral public key)
+ */
+public class MQVPrivateKeySpec
+ implements KeySpec, MQVPrivateKey
+{
+ private PrivateKey staticPrivateKey;
+ private PrivateKey ephemeralPrivateKey;
+ private PublicKey ephemeralPublicKey;
+
+ /**
+ * @param staticPrivateKey the static private key.
+ * @param ephemeralPrivateKey the ephemeral private key.
+ */
+ public MQVPrivateKeySpec(
+ PrivateKey staticPrivateKey,
+ PrivateKey ephemeralPrivateKey)
+ {
+ this(staticPrivateKey, ephemeralPrivateKey, null);
+ }
+
+ /**
+ * @param staticPrivateKey the static private key.
+ * @param ephemeralPrivateKey the ephemeral private key.
+ * @param ephemeralPublicKey the ephemeral public key (may be null).
+ */
+ public MQVPrivateKeySpec(
+ PrivateKey staticPrivateKey,
+ PrivateKey ephemeralPrivateKey,
+ PublicKey ephemeralPublicKey)
+ {
+ this.staticPrivateKey = staticPrivateKey;
+ this.ephemeralPrivateKey = ephemeralPrivateKey;
+ this.ephemeralPublicKey = ephemeralPublicKey;
+ }
+
+ /**
+ * return the static private key
+ */
+ public PrivateKey getStaticPrivateKey()
+ {
+ return staticPrivateKey;
+ }
+
+ /**
+ * return the ephemeral private key
+ */
+ public PrivateKey getEphemeralPrivateKey()
+ {
+ return ephemeralPrivateKey;
+ }
+
+ /**
+ * return the ephemeral public key (may be null)
+ */
+ public PublicKey getEphemeralPublicKey()
+ {
+ return ephemeralPublicKey;
+ }
+
+ /**
+ * return "ECMQV"
+ */
+ public String getAlgorithm()
+ {
+ return "ECMQV";
+ }
+
+ /**
+ * return null
+ */
+ public String getFormat()
+ {
+ return null;
+ }
+
+ /**
+ * returns null
+ */
+ public byte[] getEncoded()
+ {
+ return null;
+ }
+}