org.spongycastle.math.ec.ECCurve.getField()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(5.4k)|赞(0)|评价(0)|浏览(62)

本文整理了Java中org.spongycastle.math.ec.ECCurve.getField()方法的一些代码示例,展示了ECCurve.getField()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ECCurve.getField()方法的具体详情如下:
包路径:org.spongycastle.math.ec.ECCurve
类名称:ECCurve
方法名:getField

ECCurve.getField介绍

暂无

代码示例

代码示例来源:origin: com.madgag.spongycastle/core

public static boolean isFpCurve(ECCurve c)
{
  return isFpField(c.getField());
}

代码示例来源:origin: com.madgag.spongycastle/core

public static boolean isF2mCurve(ECCurve c)
{
  return isF2mField(c.getField());
}

代码示例来源:origin: com.madgag.spongycastle/core

private static ECFieldElement[] findBetaValues(ECCurve c)
{
  BigInteger q = c.getField().getCharacteristic();
  BigInteger e = q.divide(ECConstants.THREE);
  // Search for a random value that generates a non-trival cube root of 1
  SecureRandom random = new SecureRandom();
  BigInteger b;
  do
  {
    BigInteger r = BigIntegers.createRandomInRange(ECConstants.TWO, q.subtract(ECConstants.TWO), random);
    b = r.modPow(e, q);
  }
  while (b.equals(ECConstants.ONE));
  ECFieldElement beta = c.fromBigInteger(b);
  return new ECFieldElement[]{ beta, beta.square() }; 
}

代码示例来源:origin: com.madgag.spongycastle/core

public boolean equals(ECCurve other)
{
  return this == other
    || (null != other
      && getField().equals(other.getField())
      && getA().toBigInteger().equals(other.getA().toBigInteger())
      && getB().toBigInteger().equals(other.getB().toBigInteger()));
}

代码示例来源:origin: com.madgag.spongycastle/core

public int hashCode() 
{
  return getField().hashCode()
    ^ Integers.rotateLeft(getA().toBigInteger().hashCode(), 8)
    ^ Integers.rotateLeft(getB().toBigInteger().hashCode(), 16);
}

代码示例来源:origin: com.madgag.spongycastle/core

public static void discoverEndomorphisms(X9ECParameters x9)
{
  if (x9 == null)
  {
    throw new NullPointerException("x9");
  }
  ECCurve c = x9.getCurve();
  if (ECAlgorithms.isFpCurve(c))
  {
    BigInteger characteristic = c.getField().getCharacteristic();
    if (c.getA().isZero() && characteristic.mod(ECConstants.THREE).equals(ECConstants.ONE))
    {
      System.out.println("Curve has a 'GLV Type B' endomorphism with these parameters:");
      printGLVTypeBParameters(x9);
    }
  }
}

代码示例来源:origin: com.madgag.spongycastle/core

private static void discoverEndomorphisms(String curveName)
{
  X9ECParameters x9 = ECNamedCurveTable.getByName(curveName);
  if (x9 == null)
  {
    System.err.println("Unknown curve: " + curveName);
    return;
  }
  ECCurve c = x9.getCurve();
  if (ECAlgorithms.isFpCurve(c))
  {
    BigInteger characteristic = c.getField().getCharacteristic();
    if (c.getA().isZero() && characteristic.mod(ECConstants.THREE).equals(ECConstants.ONE))
    {
      System.out.println("Curve '" + curveName + "' has a 'GLV Type B' endomorphism with these parameters:");
      printGLVTypeBParameters(x9);
    }
  }
}

代码示例来源:origin: com.madgag.spongycastle/core

this.fieldID = new X9FieldID(curve.getField().getCharacteristic());
PolynomialExtensionField field = (PolynomialExtensionField)curve.getField();
int[] exponents = field.getMinimalPolynomial().getExponentsPresent();
if (exponents.length == 3)

代码示例来源:origin: com.madgag.spongycastle/prov

public static EllipticCurve convertCurve(
  ECCurve curve, 
  byte[]  seed)
{
  ECField field = convertField(curve.getField());
  BigInteger a = curve.getA().toBigInteger(), b = curve.getB().toBigInteger();
  // TODO: the Sun EC implementation doesn't currently handle the seed properly
  // so at the moment it's set to null. Should probably look at making this configurable
  return new EllipticCurve(field, a, b, null);
}

代码示例来源:origin: com.madgag.spongycastle/prov

private static EllipticCurve convertCurve(
  ECCurve  curve,
  byte[]   seed)
{
  ECField field = convertField(curve.getField());
  BigInteger a = curve.getA().toBigInteger(), b = curve.getB().toBigInteger();
  return new EllipticCurve(field, a, b, seed);
}

代码示例来源:origin: com.madgag.spongycastle/pkix

private static EllipticCurve convertCurve(
  ECCurve curve)
{
  ECField field = convertField(curve.getField());
  BigInteger a = curve.getA().toBigInteger(), b = curve.getB().toBigInteger();
  // TODO: the Sun EC implementation doesn't currently handle the seed properly
  // so at the moment it's set to null. Should probably look at making this configurable
  return new EllipticCurve(field, a, b, null);
}

代码示例来源:origin: com.madgag.spongycastle/bcpkix-jdk15on

private static EllipticCurve convertCurve(
  ECCurve curve)
{
  ECField field = convertField(curve.getField());
  BigInteger a = curve.getA().toBigInteger(), b = curve.getB().toBigInteger();
  // TODO: the Sun EC implementation doesn't currently handle the seed properly
  // so at the moment it's set to null. Should probably look at making this configurable
  return new EllipticCurve(field, a, b, null);
}

代码示例来源:origin: com.madgag.spongycastle/core

public DSTU4145ECBinary(ECDomainParameters params)
{
  ECCurve curve = params.getCurve();
  if (!ECAlgorithms.isF2mCurve(curve))
  {
    throw new IllegalArgumentException("only binary domain is possible");
  }
  // We always use big-endian in parameter encoding
  PolynomialExtensionField field = (PolynomialExtensionField)curve.getField();
  int[] exponents = field.getMinimalPolynomial().getExponentsPresent();
  if (exponents.length == 3)
  {
    f = new DSTU4145BinaryField(exponents[2], exponents[1]);
  }
  else if (exponents.length == 5)
  {
    f = new DSTU4145BinaryField(exponents[4], exponents[1], exponents[2], exponents[3]);
  }
  else
  {
    throw new IllegalArgumentException("curve must have a trinomial or pentanomial basis");
  }
  a = new ASN1Integer(curve.getA().toBigInteger());
  b = new DEROctetString(curve.getB().getEncoded());
  n = new ASN1Integer(params.getN());
  bp = new DEROctetString(DSTU4145PointEncoder.encodePoint(params.getG()));
}

代码示例来源:origin: com.madgag.spongycastle/core

writeECParameter(curve.getField().getCharacteristic(), output);
PolynomialExtensionField field = (PolynomialExtensionField)curve.getField();
int[] exponents = field.getMinimalPolynomial().getExponentsPresent();

相关文章