diff options
author | Sergio Giro <sgiro@google.com> | 2016-02-01 18:54:35 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2016-02-01 18:54:35 +0000 |
commit | 3e75bd6b407dd472c834a50f16aae54cca67ea9c (patch) | |
tree | b5eb091b97b2aade28e5b45a15352125a4a776d7 /bcprov/src/main/java/org/bouncycastle/crypto/tls/ServerDHParams.java | |
parent | 9218edabd1ef9852bc2f13115dcadc81b442dd6c (diff) | |
parent | c1040cb5656c3299f1c2d0fe0bd7c44b10466aaf (diff) | |
download | android_external_bouncycastle-3e75bd6b407dd472c834a50f16aae54cca67ea9c.tar.gz android_external_bouncycastle-3e75bd6b407dd472c834a50f16aae54cca67ea9c.tar.bz2 android_external_bouncycastle-3e75bd6b407dd472c834a50f16aae54cca67ea9c.zip |
Merge "Restoring the contents of aosp after"
Diffstat (limited to 'bcprov/src/main/java/org/bouncycastle/crypto/tls/ServerDHParams.java')
-rw-r--r-- | bcprov/src/main/java/org/bouncycastle/crypto/tls/ServerDHParams.java | 63 |
1 files changed, 0 insertions, 63 deletions
diff --git a/bcprov/src/main/java/org/bouncycastle/crypto/tls/ServerDHParams.java b/bcprov/src/main/java/org/bouncycastle/crypto/tls/ServerDHParams.java deleted file mode 100644 index 911338e..0000000 --- a/bcprov/src/main/java/org/bouncycastle/crypto/tls/ServerDHParams.java +++ /dev/null @@ -1,63 +0,0 @@ -package org.bouncycastle.crypto.tls; - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.math.BigInteger; - -import org.bouncycastle.crypto.params.DHParameters; -import org.bouncycastle.crypto.params.DHPublicKeyParameters; - -public class ServerDHParams -{ - protected DHPublicKeyParameters publicKey; - - public ServerDHParams(DHPublicKeyParameters publicKey) - { - if (publicKey == null) - { - throw new IllegalArgumentException("'publicKey' cannot be null"); - } - - this.publicKey = publicKey; - } - - public DHPublicKeyParameters getPublicKey() - { - return publicKey; - } - - /** - * Encode this {@link ServerDHParams} to an {@link OutputStream}. - * - * @param output - * the {@link OutputStream} to encode to. - * @throws IOException - */ - public void encode(OutputStream output) throws IOException - { - DHParameters dhParameters = publicKey.getParameters(); - BigInteger Ys = publicKey.getY(); - - TlsDHUtils.writeDHParameter(dhParameters.getP(), output); - TlsDHUtils.writeDHParameter(dhParameters.getG(), output); - TlsDHUtils.writeDHParameter(Ys, output); - } - - /** - * Parse a {@link ServerDHParams} from an {@link InputStream}. - * - * @param input - * the {@link InputStream} to parse from. - * @return a {@link ServerDHParams} object. - * @throws IOException - */ - public static ServerDHParams parse(InputStream input) throws IOException - { - BigInteger p = TlsDHUtils.readDHParameter(input); - BigInteger g = TlsDHUtils.readDHParameter(input); - BigInteger Ys = TlsDHUtils.readDHParameter(input); - - return new ServerDHParams(TlsDHUtils.validateDHPublicKey(new DHPublicKeyParameters(Ys, new DHParameters(p, g)))); - } -} |