FileDocCategorySizeDatePackage
X9Curve.javaAPI DocAzureus 3.0.3.42436Mon Mar 20 04:56:46 GMT 2006org.bouncycastle.asn1.x9

X9Curve

public class X9Curve extends Object implements X9ObjectIdentifiers, org.bouncycastle.asn1.DEREncodable
ASN.1 def for Elliptic-Curve Curve structure. See X9.62, for further details.

Fields Summary
private org.bouncycastle.math.ec.ECCurve
curve
private byte[]
seed
Constructors Summary
public X9Curve(org.bouncycastle.math.ec.ECCurve curve)

        this.curve = curve;
        this.seed = null;
	
public X9Curve(org.bouncycastle.math.ec.ECCurve curve, byte[] seed)

        this.curve = curve;
        this.seed = seed;
	
public X9Curve(X9FieldID fieldID, org.bouncycastle.asn1.ASN1Sequence seq)

        if (fieldID.getIdentifier().equals(prime_field))
        {
            BigInteger      q = ((DERInteger)fieldID.getParameters()).getValue();
            X9FieldElement  x9A = new X9FieldElement(true, q, (ASN1OctetString)seq.getObjectAt(0));
            X9FieldElement  x9B = new X9FieldElement(true, q, (ASN1OctetString)seq.getObjectAt(1));
            curve = new ECCurve.Fp(q, x9A.getValue().toBigInteger(), x9B.getValue().toBigInteger());
        }
        else
        {
            throw new RuntimeException("not implemented");
        }

        if (seq.size() == 3)
        {
            seed = ((DERBitString)seq.getObjectAt(2)).getBytes();
        }
    
Methods Summary
public org.bouncycastle.math.ec.ECCurvegetCurve()

        return curve;
    
public org.bouncycastle.asn1.DERObjectgetDERObject()
Produce an object suitable for an ASN1OutputStream.
Curve ::= SEQUENCE {
a FieldElement,
b FieldElement,
seed BIT STRING OPTIONAL
}

        ASN1EncodableVector v = new ASN1EncodableVector();

        v.add(new X9FieldElement(curve.getA()).getDERObject());
        v.add(new X9FieldElement(curve.getB()).getDERObject());

        if (seed != null)
        {
            v.add(new DERBitString(seed));
        }

        return new DERSequence(v);
    
public byte[]getSeed()

        return seed;