• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 package org.bouncycastle.crypto.params;
2 
3 import org.bouncycastle.math.ec.ECPoint;
4 
5 public class ECPublicKeyParameters
6     extends ECKeyParameters
7 {
8     private final ECPoint Q;
9 
ECPublicKeyParameters( ECPoint Q, ECDomainParameters params)10     public ECPublicKeyParameters(
11         ECPoint             Q,
12         ECDomainParameters  params)
13     {
14         super(false, params);
15 
16         this.Q = validate(Q);
17     }
18 
validate(ECPoint q)19     private ECPoint validate(ECPoint q)
20     {
21         if (q == null)
22         {
23             throw new IllegalArgumentException("point has null value");
24         }
25 
26         if (q.isInfinity())
27         {
28             throw new IllegalArgumentException("point at infinity");
29         }
30 
31         q = q.normalize();
32 
33         if (!q.isValid())
34         {
35             throw new IllegalArgumentException("point not on curve");
36         }
37 
38         return q;
39     }
40 
getQ()41     public ECPoint getQ()
42     {
43         return Q;
44     }
45 }
46