blob: d984bcd431ce69a47201e58543d64451ce2dcd65 (
plain)
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
43
44
45
46
47
48
|
package org.spongycastle.asn1.x9;
import org.spongycastle.asn1.ASN1Object;
import org.spongycastle.asn1.ASN1OctetString;
import org.spongycastle.asn1.ASN1Primitive;
import org.spongycastle.asn1.DEROctetString;
import org.spongycastle.math.ec.ECCurve;
import org.spongycastle.math.ec.ECPoint;
/**
* class for describing an ECPoint as a DER object.
*/
public class X9ECPoint
extends ASN1Object
{
ECPoint p;
public X9ECPoint(
ECPoint p)
{
this.p = p.normalize();
}
public X9ECPoint(
ECCurve c,
ASN1OctetString s)
{
this.p = c.decodePoint(s.getOctets());
}
public ECPoint getPoint()
{
return p;
}
/**
* Produce an object suitable for an ASN1OutputStream.
* <pre>
* ECPoint ::= OCTET STRING
* </pre>
* <p>
* Octet string produced using ECPoint.getEncoded().
*/
public ASN1Primitive toASN1Primitive()
{
return new DEROctetString(p.getEncoded());
}
}
|