• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 package org.bouncycastle.math.ec.custom.sec;
2 
3 import java.math.BigInteger;
4 
5 import org.bouncycastle.math.ec.ECCurve;
6 import org.bouncycastle.math.ec.ECFieldElement;
7 import org.bouncycastle.math.ec.ECPoint;
8 import org.bouncycastle.util.encoders.Hex;
9 
10 public class SecP192R1Curve extends ECCurve.AbstractFp
11 {
12     public static final BigInteger q = new BigInteger(1,
13         Hex.decode("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFF"));
14 
15     private static final int SecP192R1_DEFAULT_COORDS = COORD_JACOBIAN;
16 
17     protected SecP192R1Point infinity;
18 
SecP192R1Curve()19     public SecP192R1Curve()
20     {
21         super(q);
22 
23         this.infinity = new SecP192R1Point(this, null, null);
24 
25         this.a = fromBigInteger(new BigInteger(1,
26             Hex.decode("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFC")));
27         this.b = fromBigInteger(new BigInteger(1,
28             Hex.decode("64210519E59C80E70FA7E9AB72243049FEB8DEECC146B9B1")));
29         this.order = new BigInteger(1, Hex.decode("FFFFFFFFFFFFFFFFFFFFFFFF99DEF836146BC9B1B4D22831"));
30         this.cofactor = BigInteger.valueOf(1);
31 
32         this.coord = SecP192R1_DEFAULT_COORDS;
33     }
34 
cloneCurve()35     protected ECCurve cloneCurve()
36     {
37         return new SecP192R1Curve();
38     }
39 
supportsCoordinateSystem(int coord)40     public boolean supportsCoordinateSystem(int coord)
41     {
42         switch (coord)
43         {
44         case COORD_JACOBIAN:
45             return true;
46         default:
47             return false;
48         }
49     }
50 
getQ()51     public BigInteger getQ()
52     {
53         return q;
54     }
55 
getFieldSize()56     public int getFieldSize()
57     {
58         return q.bitLength();
59     }
60 
fromBigInteger(BigInteger x)61     public ECFieldElement fromBigInteger(BigInteger x)
62     {
63         return new SecP192R1FieldElement(x);
64     }
65 
createRawPoint(ECFieldElement x, ECFieldElement y, boolean withCompression)66     protected ECPoint createRawPoint(ECFieldElement x, ECFieldElement y, boolean withCompression)
67     {
68         return new SecP192R1Point(this, x, y, withCompression);
69     }
70 
createRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, boolean withCompression)71     protected ECPoint createRawPoint(ECFieldElement x, ECFieldElement y, ECFieldElement[] zs, boolean withCompression)
72     {
73         return new SecP192R1Point(this, x, y, zs, withCompression);
74     }
75 
getInfinity()76     public ECPoint getInfinity()
77     {
78         return infinity;
79     }
80 }
81