Mercurial > 510Connectbot
annotate app/src/main/java/ch/ethz/ssh2/crypto/dh/DhExchange.java @ 493:0a17c6e7cb0f stable-1.9.4-3
improve Makefile
author | Carl Byington <carl@five-ten-sg.com> |
---|---|
date | Tue, 15 Feb 2022 14:07:00 -0800 |
parents | d29cce60f393 |
children |
rev | line source |
---|---|
309
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
1 /** |
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
2 * |
273
91a31873c42a
start conversion from trilead to ganymed
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
3 */ |
91a31873c42a
start conversion from trilead to ganymed
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
4 package ch.ethz.ssh2.crypto.dh; |
91a31873c42a
start conversion from trilead to ganymed
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
5 |
91a31873c42a
start conversion from trilead to ganymed
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
6 import java.io.IOException; |
91a31873c42a
start conversion from trilead to ganymed
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
7 import java.math.BigInteger; |
309
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
8 import java.security.InvalidAlgorithmParameterException; |
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
9 import java.security.InvalidKeyException; |
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
10 import java.security.KeyFactory; |
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
11 import java.security.KeyPair; |
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
12 import java.security.KeyPairGenerator; |
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
13 import java.security.NoSuchAlgorithmException; |
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
14 import java.security.spec.InvalidKeySpecException; |
273
91a31873c42a
start conversion from trilead to ganymed
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
15 |
309
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
16 import javax.crypto.KeyAgreement; |
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
17 import javax.crypto.interfaces.DHPrivateKey; |
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
18 import javax.crypto.interfaces.DHPublicKey; |
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
19 import javax.crypto.spec.DHParameterSpec; |
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
20 import javax.crypto.spec.DHPublicKeySpec; |
273
91a31873c42a
start conversion from trilead to ganymed
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
21 |
91a31873c42a
start conversion from trilead to ganymed
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
22 /** |
309
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
23 * @author kenny |
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
24 * |
273
91a31873c42a
start conversion from trilead to ganymed
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
25 */ |
309
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
26 public class DhExchange extends GenericDhExchange { |
273
91a31873c42a
start conversion from trilead to ganymed
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
27 |
307 | 28 /* Given by the standard */ |
273
91a31873c42a
start conversion from trilead to ganymed
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
29 |
309
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
30 private static final BigInteger P1 = new BigInteger( |
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
31 "FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD1" |
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
32 + "29024E088A67CC74020BBEA63B139B22514A08798E3404DD" |
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
33 + "EF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245" |
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
34 + "E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED" |
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
35 + "EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE65381" |
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
36 + "FFFFFFFFFFFFFFFF", 16); |
273
91a31873c42a
start conversion from trilead to ganymed
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
37 |
309
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
38 private static final BigInteger P14 = new BigInteger( |
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
39 "FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD1" |
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
40 + "29024E088A67CC74020BBEA63B139B22514A08798E3404DD" |
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
41 + "EF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245" |
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
42 + "E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED" |
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
43 + "EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3D" |
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
44 + "C2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F" |
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
45 + "83655D23DCA3AD961C62F356208552BB9ED529077096966D" |
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
46 + "670C354E4ABC9804F1746C08CA18217C32905E462E36CE3B" |
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
47 + "E39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9" |
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
48 + "DE2BCBF6955817183995497CEA956AE515D2261898FA0510" |
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
49 + "15728E5A8AACAA68FFFFFFFFFFFFFFFF", 16); |
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
50 |
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
51 private static final BigInteger G = BigInteger.valueOf(2); |
273
91a31873c42a
start conversion from trilead to ganymed
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
52 |
307 | 53 /* Client public and private */ |
273
91a31873c42a
start conversion from trilead to ganymed
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
54 |
309
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
55 private DHPrivateKey clientPrivate; |
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
56 private DHPublicKey clientPublic; |
273
91a31873c42a
start conversion from trilead to ganymed
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
57 |
309
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
58 /* Server public */ |
273
91a31873c42a
start conversion from trilead to ganymed
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
59 |
309
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
60 private DHPublicKey serverPublic; |
313
1d400fd78e4a
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
309
diff
changeset
|
61 private byte[] f; |
273
91a31873c42a
start conversion from trilead to ganymed
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
62 |
309
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
63 @Override |
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
64 public void init(String name) throws IOException { |
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
65 final DHParameterSpec spec; |
273
91a31873c42a
start conversion from trilead to ganymed
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
66 |
309
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
67 if ("diffie-hellman-group1-sha1".equals(name)) { |
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
68 spec = new DHParameterSpec(P1, G); |
273
91a31873c42a
start conversion from trilead to ganymed
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
69 } |
309
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
70 else if ("diffie-hellman-group14-sha1".equals(name)) { |
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
71 spec = new DHParameterSpec(P14, G); |
273
91a31873c42a
start conversion from trilead to ganymed
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
72 } |
91a31873c42a
start conversion from trilead to ganymed
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
73 else { |
309
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
74 throw new IllegalArgumentException("Unknown DH group " + name); |
273
91a31873c42a
start conversion from trilead to ganymed
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
75 } |
91a31873c42a
start conversion from trilead to ganymed
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
76 |
309
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
77 try { |
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
78 KeyPairGenerator kpg = KeyPairGenerator.getInstance("DH"); |
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
79 kpg.initialize(spec); |
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
80 KeyPair pair = kpg.generateKeyPair(); |
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
81 clientPrivate = (DHPrivateKey) pair.getPrivate(); |
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
82 clientPublic = (DHPublicKey) pair.getPublic(); |
273
91a31873c42a
start conversion from trilead to ganymed
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
83 } |
309
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
84 catch (NoSuchAlgorithmException e) { |
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
85 throw(IOException) new IOException("No DH keypair generator").initCause(e); |
273
91a31873c42a
start conversion from trilead to ganymed
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
86 } |
309
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
87 catch (InvalidAlgorithmParameterException e) { |
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
88 throw(IOException) new IOException("Invalid DH parameters").initCause(e); |
273
91a31873c42a
start conversion from trilead to ganymed
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
89 } |
91a31873c42a
start conversion from trilead to ganymed
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
90 } |
91a31873c42a
start conversion from trilead to ganymed
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
91 |
309
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
92 @Override |
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
93 public byte[] getE() { |
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
94 if (clientPublic == null) |
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
95 throw new IllegalStateException("DhExchange not initialized!"); |
273
91a31873c42a
start conversion from trilead to ganymed
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
96 |
309
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
97 return clientPublic.getY().toByteArray(); |
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
98 } |
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
99 |
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
100 @Override |
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
101 protected byte[] getServerE() { |
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
102 if (serverPublic == null) |
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
103 throw new IllegalStateException("DhExchange not initialized!"); |
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
104 |
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
105 return serverPublic.getY().toByteArray(); |
273
91a31873c42a
start conversion from trilead to ganymed
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
106 } |
91a31873c42a
start conversion from trilead to ganymed
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
107 |
309
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
108 @Override |
313
1d400fd78e4a
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
309
diff
changeset
|
109 public byte[] getF() { |
1d400fd78e4a
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
309
diff
changeset
|
110 return f; |
1d400fd78e4a
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
309
diff
changeset
|
111 } |
1d400fd78e4a
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
309
diff
changeset
|
112 |
1d400fd78e4a
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
309
diff
changeset
|
113 @Override |
309
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
114 public void setF(byte[] f) throws IOException { |
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
115 if (clientPublic == null) |
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
116 throw new IllegalStateException("DhExchange not initialized!"); |
273
91a31873c42a
start conversion from trilead to ganymed
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
117 |
309
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
118 final KeyAgreement ka; |
273
91a31873c42a
start conversion from trilead to ganymed
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
119 |
309
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
120 try { |
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
121 KeyFactory kf = KeyFactory.getInstance("DH"); |
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
122 DHParameterSpec params = clientPublic.getParams(); |
313
1d400fd78e4a
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
309
diff
changeset
|
123 this.f = f; |
309
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
124 this.serverPublic = (DHPublicKey) kf.generatePublic(new DHPublicKeySpec( |
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
125 new BigInteger(f), params.getP(), params.getG())); |
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
126 ka = KeyAgreement.getInstance("DH"); |
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
127 ka.init(clientPrivate); |
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
128 ka.doPhase(serverPublic, true); |
273
91a31873c42a
start conversion from trilead to ganymed
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
129 } |
309
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
130 catch (NoSuchAlgorithmException e) { |
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
131 throw(IOException) new IOException("No DH key agreement method").initCause(e); |
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
132 } |
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
133 catch (InvalidKeyException e) { |
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
134 throw(IOException) new IOException("Invalid DH key").initCause(e); |
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
135 } |
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
136 catch (InvalidKeySpecException e) { |
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
137 throw(IOException) new IOException("Invalid DH key").initCause(e); |
273
91a31873c42a
start conversion from trilead to ganymed
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
138 } |
91a31873c42a
start conversion from trilead to ganymed
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
139 |
309
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
140 sharedSecret = new BigInteger(ka.generateSecret()); |
273
91a31873c42a
start conversion from trilead to ganymed
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
141 } |
91a31873c42a
start conversion from trilead to ganymed
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
142 |
309
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
143 @Override |
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
144 public String getHashAlgo() { |
cb179051f0f2
add ecdsa key support everywhere
Carl Byington <carl@five-ten-sg.com>
parents:
307
diff
changeset
|
145 return "SHA1"; |
273
91a31873c42a
start conversion from trilead to ganymed
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
146 } |
91a31873c42a
start conversion from trilead to ganymed
Carl Byington <carl@five-ten-sg.com>
parents:
diff
changeset
|
147 } |