コード例 #1
0
ファイル: Secp160r1.java プロジェクト: xdel/buttermilk
  private static ECDomainParameters init(String name) {
    // p = 2^160 - 2^31 - 1
    BigInteger p = fromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFF");
    BigInteger a = fromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFC");
    BigInteger b = fromHex("1C97BEFC54BD7A8B65ACF89F81D4D4ADC565FA45");
    byte[] S = Hex.decode("1053CDE42C14D696E67687561517533BF3F83345");
    BigInteger n = fromHex("0100000000000000000001F4C8F927AED3CA752257");
    BigInteger h = BigInteger.valueOf(1);

    ECCurve curve = new ECCurve.Fp(p, a, b);

    ECPoint G =
        curve.decodePoint(
            Hex.decode(
                "04"
                    + "4A96B5688EF573284664698968C38BB913CBFC82"
                    + "23A628553168947D59DCC912042351377AC5FB32"));

    return new ECDomainParameters(curve, G, n, h, S, name);
  }
コード例 #2
0
ファイル: Secp192k1.java プロジェクト: xdel/buttermilk
  private static ECDomainParameters init(String name) {
    // p = 2^192 - 2^32 - 2^12 - 2^8 - 2^7 - 2^6 - 2^3 - 1
    BigInteger p = fromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFEE37");
    BigInteger a = ECConstants.ZERO;
    BigInteger b = BigInteger.valueOf(3);
    byte[] S = null;
    BigInteger n = fromHex("FFFFFFFFFFFFFFFFFFFFFFFE26F2FC170F69466A74DEFD8D");
    BigInteger h = BigInteger.valueOf(1);

    ECCurve curve = new ECCurve.Fp(p, a, b);
    // ECPoint G = curve.decodePoint(Hex.decode("03"
    // + "DB4FF10EC057E9AE26B07D0280B7F4341DA5D1B1EAE06C7D"));
    ECPoint G =
        curve.decodePoint(
            Hex.decode(
                "04"
                    + "DB4FF10EC057E9AE26B07D0280B7F4341DA5D1B1EAE06C7D"
                    + "9B2F2F6D9C5628A7844163D015BE86344082AA88D95E2F9D"));

    return new ECDomainParameters(curve, G, n, h, S, name);
  }