01: package org.bouncycastle.asn1.x9;
02:
03: import org.bouncycastle.asn1.ASN1Encodable;
04: import org.bouncycastle.asn1.ASN1OctetString;
05: import org.bouncycastle.asn1.DERObject;
06: import org.bouncycastle.asn1.DEROctetString;
07: import org.bouncycastle.math.ec.ECCurve;
08: import org.bouncycastle.math.ec.ECPoint;
09:
10: /**
11: * class for describing an ECPoint as a DER object.
12: */
13: public class X9ECPoint extends ASN1Encodable {
14: ECPoint p;
15:
16: public X9ECPoint(ECPoint p) {
17: this .p = p;
18: }
19:
20: public X9ECPoint(ECCurve c, ASN1OctetString s) {
21: this .p = c.decodePoint(s.getOctets());
22: }
23:
24: public ECPoint getPoint() {
25: return p;
26: }
27:
28: /**
29: * Produce an object suitable for an ASN1OutputStream.
30: * <pre>
31: * ECPoint ::= OCTET STRING
32: * </pre>
33: * <p>
34: * Octet string produced using ECPoint.getEncoded().
35: */
36: public DERObject toASN1Object() {
37: return new DEROctetString(p.getEncoded());
38: }
39: }
|