本文整理汇总了Java中org.bouncycastle.math.ec.ECCurve类的典型用法代码示例。如果您正苦于以下问题:Java ECCurve类的具体用法?Java ECCurve怎么用?Java ECCurve使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ECCurve类属于org.bouncycastle.math.ec包,在下文中一共展示了ECCurve类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createParameters
import org.bouncycastle.math.ec.ECCurve; //导入依赖的package包/类
protected X9ECParameters createParameters()
{
BigInteger c2m163v3n = new BigInteger("03FFFFFFFFFFFFFFFFFFFE1AEE140F110AFF961309", 16);
BigInteger c2m163v3h = BigInteger.valueOf(2);
ECCurve c2m163v3 = new ECCurve.F2m(
163,
1, 2, 8,
new BigInteger("07A526C63D3E25A256A007699F5447E32AE456B50E", 16),
new BigInteger("03F7061798EB99E238FD6F1BF95B48FEEB4854252B", 16),
c2m163v3n, c2m163v3h);
return new X9ECParameters(
c2m163v3,
c2m163v3.decodePoint(
Hex.decode("0202F9F87B7C574D0BDECF8A22E6524775F98CDEBDCB")),
c2m163v3n, c2m163v3h,
null);
}
示例2: JCEECPrivateKey
import org.bouncycastle.math.ec.ECCurve; //导入依赖的package包/类
public JCEECPrivateKey(
String algorithm,
org.bouncycastle.jce.spec.ECPrivateKeySpec spec)
{
this.algorithm = algorithm;
this.d = spec.getD();
if (spec.getParams() != null) // can be null if implicitlyCA
{
ECCurve curve = spec.getParams().getCurve();
EllipticCurve ellipticCurve;
ellipticCurve = EC5Util.convertCurve(curve, spec.getParams().getSeed());
this.ecSpec = EC5Util.convertSpec(ellipticCurve, spec.getParams());
}
else
{
this.ecSpec = null;
}
}
示例3: JCEECPublicKey
import org.bouncycastle.math.ec.ECCurve; //导入依赖的package包/类
public JCEECPublicKey(
String algorithm,
org.bouncycastle.jce.spec.ECPublicKeySpec spec)
{
this.algorithm = algorithm;
this.q = spec.getQ();
if (spec.getParams() != null) // can be null if implictlyCa
{
ECCurve curve = spec.getParams().getCurve();
EllipticCurve ellipticCurve = EC5Util.convertCurve(curve, spec.getParams().getSeed());
this.ecSpec = EC5Util.convertSpec(ellipticCurve, spec.getParams());
}
else
{
if (q.getCurve() == null)
{
org.bouncycastle.jce.spec.ECParameterSpec s = BouncyCastleProvider.CONFIGURATION.getEcImplicitlyCa();
q = s.getCurve().createPoint(q.getX().toBigInteger(), q.getY().toBigInteger(), false);
}
this.ecSpec = null;
}
}
示例4: getParams
import org.bouncycastle.math.ec.ECCurve; //导入依赖的package包/类
private ECParameterSpec getParams(ECDSAPublicKey key)
{
if (!key.hasParameters())
{
throw new IllegalArgumentException("Public key does not contains EC Params");
}
BigInteger p = key.getPrimeModulusP();
ECCurve.Fp curve = new ECCurve.Fp(p, key.getFirstCoefA(), key.getSecondCoefB());
ECPoint G = curve.decodePoint(key.getBasePointG());
BigInteger order = key.getOrderOfBasePointR();
BigInteger coFactor = key.getCofactorF();
// TODO: update to use JDK 1.5 EC API
ECParameterSpec ecspec = new ECParameterSpec(curve, G, order, coFactor);
return ecspec;
}
示例5: BCECGOST3410PrivateKey
import org.bouncycastle.math.ec.ECCurve; //导入依赖的package包/类
public BCECGOST3410PrivateKey(
org.bouncycastle.jce.spec.ECPrivateKeySpec spec)
{
this.d = spec.getD();
if (spec.getParams() != null) // can be null if implicitlyCA
{
ECCurve curve = spec.getParams().getCurve();
EllipticCurve ellipticCurve;
ellipticCurve = EC5Util.convertCurve(curve, spec.getParams().getSeed());
this.ecSpec = EC5Util.convertSpec(ellipticCurve, spec.getParams());
}
else
{
this.ecSpec = null;
}
}
示例6: serializeECPoint
import org.bouncycastle.math.ec.ECCurve; //导入依赖的package包/类
public static byte[] serializeECPoint(short[] ecPointFormats, ECPoint point)
throws IOException
{
ECCurve curve = point.getCurve();
/*
* RFC 4492 5.7. ...an elliptic curve point in uncompressed or compressed format. Here, the
* format MUST conform to what the server has requested through a Supported Point Formats
* Extension if this extension was used, and MUST be uncompressed if this extension was not
* used.
*/
boolean compressed = false;
if (curve instanceof ECCurve.F2m)
{
compressed = isCompressionPreferred(ecPointFormats, ECPointFormat.ansiX962_compressed_char2);
}
else if (curve instanceof ECCurve.Fp)
{
compressed = isCompressionPreferred(ecPointFormats, ECPointFormat.ansiX962_compressed_prime);
}
return point.getEncoded(compressed);
}
示例7: ECPointDeSerialization
import org.bouncycastle.math.ec.ECCurve; //导入依赖的package包/类
public static ECPoint ECPointDeSerialization(ECCurve curve, byte[] serialized_point, int offset) {
byte[] x_b = new byte[256 / 8];
byte[] y_b = new byte[256 / 8];
// System.out.println("Serialized Point: " + toHex(serialized_point));
// src -- This is the source array.
// srcPos -- This is the starting position in the source array.
// dest -- This is the destination array.
// destPos -- This is the starting position in the destination data.
// length -- This is the number of array elements to be copied.
System.arraycopy(serialized_point, offset + 1, x_b, 0, Consts.SHARE_BASIC_SIZE);
BigInteger x = new BigInteger(bytesToHex(x_b), 16);
// System.out.println("X:" + toHex(x_b));
System.arraycopy(serialized_point, offset + (Consts.SHARE_BASIC_SIZE + 1), y_b, 0, Consts.SHARE_BASIC_SIZE);
BigInteger y = new BigInteger(bytesToHex(y_b), 16);
// System.out.println("Y:" + toHex(y_b));
ECPoint point = curve.createPoint(x, y);
return point;
}
示例8: convertCurve
import org.bouncycastle.math.ec.ECCurve; //导入依赖的package包/类
public static ECCurve convertCurve(
EllipticCurve ec)
{
ECField field = ec.getField();
BigInteger a = ec.getA();
BigInteger b = ec.getB();
if (field instanceof ECFieldFp)
{
return new ECCurve.Fp(((ECFieldFp)field).getP(), a, b);
}
else
{
ECFieldF2m fieldF2m = (ECFieldF2m)field;
int m = fieldF2m.getM();
int ks[] = ECUtil.convertMidTerms(fieldF2m.getMidTermsOfReductionPolynomial());
return new ECCurve.F2m(m, ks[0], ks[1], ks[2], a, b);
}
}
示例9: createParameters
import org.bouncycastle.math.ec.ECCurve; //导入依赖的package包/类
protected X9ECParameters createParameters()
{
// p = (2^128 - 3) / 76439
BigInteger p = fromHex("DB7C2ABF62E35E668076BEAD208B");
BigInteger a = fromHex("DB7C2ABF62E35E668076BEAD2088");
BigInteger b = fromHex("659EF8BA043916EEDE8911702B22");
byte[] S = Hex.decode("00F50B028E4D696E676875615175290472783FB1");
BigInteger n = fromHex("DB7C2ABF62E35E7628DFAC6561C5");
BigInteger h = BigInteger.valueOf(1);
ECCurve curve = new ECCurve.Fp(p, a, b);
//ECPoint G = curve.decodePoint(Hex.decode("02"
//+ "09487239995A5EE76B55F9C2F098"));
ECPoint G = curve.decodePoint(Hex.decode("04"
+ "09487239995A5EE76B55F9C2F098"
+ "A89CE5AF8724C0A23E0E0FF77500"));
return new X9ECParameters(curve, G, n, h, S);
}
示例10: BCECGOST3410PublicKey
import org.bouncycastle.math.ec.ECCurve; //导入依赖的package包/类
public BCECGOST3410PublicKey(
org.bouncycastle.jce.spec.ECPublicKeySpec spec)
{
this.q = spec.getQ();
if (spec.getParams() != null) // can be null if implictlyCa
{
ECCurve curve = spec.getParams().getCurve();
EllipticCurve ellipticCurve = EC5Util.convertCurve(curve, spec.getParams().getSeed());
this.ecSpec = EC5Util.convertSpec(ellipticCurve, spec.getParams());
}
else
{
if (q.getCurve() == null)
{
org.bouncycastle.jce.spec.ECParameterSpec s = BouncyCastleProvider.CONFIGURATION.getEcImplicitlyCa();
q = s.getCurve().createPoint(q.getX().toBigInteger(), q.getY().toBigInteger(), false);
}
this.ecSpec = null;
}
}
示例11: DSTU4145ECBinary
import org.bouncycastle.math.ec.ECCurve; //导入依赖的package包/类
public DSTU4145ECBinary(ECDomainParameters params)
{
if (!(params.getCurve() instanceof ECCurve.F2m))
{
throw new IllegalArgumentException("only binary domain is possible");
}
// We always use big-endian in parameter encoding
ECCurve.F2m curve = (ECCurve.F2m)params.getCurve();
f = new DSTU4145BinaryField(curve.getM(), curve.getK1(), curve.getK2(), curve.getK3());
a = new ASN1Integer(curve.getA().toBigInteger());
X9IntegerConverter converter = new X9IntegerConverter();
b = new DEROctetString(converter.integerToBytes(curve.getB().toBigInteger(), converter.getByteLength(curve)));
n = new ASN1Integer(params.getN());
bp = new DEROctetString(DSTU4145PointEncoder.encodePoint(params.getG()));
}