-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathKeyGenerate.java
More file actions
37 lines (30 loc) · 795 Bytes
/
KeyGenerate.java
File metadata and controls
37 lines (30 loc) · 795 Bytes
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
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package org.Stan.Crypt.ECC;
import java.math.BigInteger;
import java.security.SecureRandom;
/**
*
* @author Sandro
*/
public class KeyGenerate {
private BigInteger xg, yg, zp, privateKey, seed;
private Point pointG = new Point();
private SecureRandom random = new SecureRandom();
public KeyGenerate(int keySize, Curve curve) {
this.zp = curve.getZp();
this.pointG = new Point(curve);
this.seed = curve.getSeed();
privateKey = BigInteger.probablePrime(keySize,
new SecureRandom(seed.toByteArray()));
pointG.equal(pointG.factors(privateKey, pointG));
}
public Point getPublicKey() {
return pointG;
}
public BigInteger getPrivateKey() {
return privateKey;
}
}