-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDecryption.java
More file actions
41 lines (34 loc) · 936 Bytes
/
Decryption.java
File metadata and controls
41 lines (34 loc) · 936 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
38
39
40
41
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package org.Stan.Crypt.ECC;
import java.util.Vector;
import java.math.BigInteger;
/**
*
* @author Stan Chen
*/
public class Decryption {
Vector pltxt = new Vector();
String message;
public Decryption(Point sdPuKey, BigInteger reSeKey, String cip, Curve curve) {
Vector cipher = new Vector();
Point cipPoint = new Point(cip);
cipher.add(cipPoint);
Point g = new Point(curve);
Point temp = new Point(curve);
sdPuKey.setZp(curve.getZp());
g.equal(sdPuKey.factors(reSeKey, sdPuKey));
g.setY(g.getY().negate().mod(sdPuKey.getZp()));
for (int i = 0; i < cipher.size(); i++) {
temp.equal(g);
pltxt.addElement(temp.pointAdd((Point) cipher.elementAt(i)));
}
InverseMessage mes = new InverseMessage(pltxt);
message = mes.getMessage().toString();
}
public String getMessage() {
return message;
}
}