-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathSidhKeyPair.java
More file actions
52 lines (36 loc) · 1.21 KB
/
SidhKeyPair.java
File metadata and controls
52 lines (36 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package sidh;
/**************************************************************************************************
*
* Implements public/private keypair for the Supersingular Isogeny Diffie-Hellman key exchange
* algorithm.
*
**************************************************************************************************/
import java.math.BigInteger;
import java.util.Arrays;
public class SidhKeyPair {
private final SidhPublicKey pubKey;
private final SidhPrivateKey privKey;
public SidhKeyPair (int aOrB, SidhPrivateKey prKey, SidhKeyExchange kex) {
privKey = new SidhPrivateKey (prKey);
pubKey = new SidhPublicKey (aOrB, privKey, kex);
}
public SidhKeyPair (int aOrB, SidhKeyExchange kex) {
BigInteger order;
if (aOrB == SidhKeyExchange.ALICE)
order = kex.getOrderA ();
else
order = kex.getOrderB ();
privKey = new SidhPrivateKey (aOrB, order);
pubKey = new SidhPublicKey (aOrB, privKey, kex);
}
public SidhKeyPair (SidhPublicKey publicK, SidhPrivateKey privateK) {
pubKey = publicK;
privKey = privateK;
}
public SidhPublicKey getPublicKey() {
return pubKey;
}
public SidhPrivateKey getPrivateKey() {
return privKey;
}
}