⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 x9ecparameters.java

📁 进行与数字证书相关开发必须的java源码
💻 JAVA
字号:
// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi 
// Source File Name:   X9ECParameters.java

package jit.asn1.x9;

import jit.asn1.*;
import jit.math.BigInteger;
import jit.math.ec.ECCurve;
import jit.math.ec.ECPoint;

// Referenced classes of package jit.asn1.x9:
//            X9Curve, X9FieldID, X9ECPoint, X9ObjectIdentifiers

public class X9ECParameters
    implements DEREncodable, X9ObjectIdentifiers
{

    private static BigInteger ONE = BigInteger.valueOf(1L);
    private X9FieldID fieldID;
    private ECCurve curve;
    private ECPoint g;
    private BigInteger n;
    private BigInteger h;
    private byte seed[];

    public X9ECParameters(ASN1Sequence seq)
    {
        if(!(seq.getObjectAt(0) instanceof DERInteger) || !((DERInteger)seq.getObjectAt(0)).getValue().equals(ONE))
            throw new IllegalArgumentException("bad version in X9ECParameters");
        X9Curve x9c = new X9Curve(new X9FieldID((ASN1Sequence)seq.getObjectAt(1)), (ASN1Sequence)seq.getObjectAt(2));
        fieldID = new X9FieldID((ASN1Sequence)seq.getObjectAt(1));
        curve = x9c.getCurve();
        g = (new X9ECPoint(curve, (ASN1OctetString)seq.getObjectAt(3))).getPoint();
        n = ((DERInteger)seq.getObjectAt(4)).getValue();
        seed = x9c.getSeed();
        if(seq.size() == 6)
            h = ((DERInteger)seq.getObjectAt(5)).getValue();
    }

    public X9ECParameters(ECCurve curve, ECPoint g, BigInteger n)
    {
        this(curve, g, n, ONE, null);
    }

    public X9ECParameters(ECCurve curve, ECPoint g, BigInteger n, BigInteger h)
    {
        this(curve, g, n, h, null);
    }

    public X9ECParameters(ECCurve curve, ECPoint g, BigInteger n, BigInteger h, byte seed[])
    {
        this.curve = curve;
        this.g = g;
        this.n = n;
        if(h == null)
            this.h = ONE;
        else
            this.h = h;
        this.seed = seed;
        if(curve instanceof jit.math.ec.ECCurve.Fp)
            fieldID = new X9FieldID(X9ObjectIdentifiers.prime_field, ((jit.math.ec.ECCurve.Fp)curve).getQ());
        else
            fieldID = new X9FieldID(X9ObjectIdentifiers.characteristic_two_field, null);
    }

    public ECCurve getCurve()
    {
        return curve;
    }

    public ECPoint getG()
    {
        return g;
    }

    public BigInteger getN()
    {
        return n;
    }

    public BigInteger getH()
    {
        return h;
    }

    public byte[] getSeed()
    {
        return seed;
    }

    public DERObject getDERObject()
    {
        ASN1EncodableVector v = new ASN1EncodableVector();
        v.add(new DERInteger(1));
        v.add(fieldID);
        v.add(new X9Curve(curve, seed));
        v.add(new X9ECPoint(g));
        v.add(new DERInteger(n));
        if(!h.equals(BigInteger.valueOf(1L)))
            v.add(new DERInteger(h));
        return new DERSequence(v);
    }

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -