-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathInsecureCurveException.java
42 lines (33 loc) · 1.07 KB
/
InsecureCurveException.java
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
//package ecc.elliptic;
import java.math.BigInteger;
public class InsecureCurveException extends Exception{
public static final int NONPRIMEMODULUS = -1;
public static final int SINGULAR = 0;
public static final int SUPERSINGULAR = 1;
public static final int ANOMALOUS = 2;
public static final int TRACEONE = 3;
private int error;
private EllipticCurve sender;
public InsecureCurveException(EllipticCurve sender){
error = SINGULAR;
this.sender = sender;
}
public InsecureCurveException(int e, EllipticCurve sender){
error = e;
this.sender = sender;
}
public int getError(){
return error;
}
public String getErrorString(){
if (error == SINGULAR) return "SINGULAR";
else if (error == NONPRIMEMODULUS) return "NONPRIMEMODULUS";
else if (error == SUPERSINGULAR) return "SUPERSINGULAR";
else if (error == ANOMALOUS) return "ANOMALOUS";
else if (error == TRACEONE) return "TRACEONE";
else return "UNKNOWN ERROR";
}
public EllipticCurve getSender(){
return sender;
}
}