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

📄 x9ecparameters.java

📁 java 文件下载器。可自定义
💻 JAVA
字号:
// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space 
// Source File Name:   X9ECParameters.java

package org.bouncycastle.asn1.x9;

import java.math.BigInteger;
import org.bouncycastle.asn1.*;
import org.bouncycastle.math.ec.ECCurve;
import org.bouncycastle.math.ec.ECPoint;

// Referenced classes of package org.bouncycastle.asn1.x9:
//			X9Curve, X9ECPoint, X9FieldID, 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));
		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();
		else
			h = ONE;
	}

	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;
		this.h = h;
		this.seed = seed;
		if (curve instanceof org.bouncycastle.math.ec.ECCurve.Fp)
			fieldID = new X9FieldID(prime_field, ((org.bouncycastle.math.ec.ECCurve.Fp)curve).getQ());
		else
			fieldID = new X9FieldID(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 + -