Java 类org.bouncycastle.crypto.signers.GOST3410Signer 实例源码

项目:ipack    文件:SignatureSpi.java   
public SignatureSpi()
{
    this.digest = new GOST3411Digest();
    this.signer = new GOST3410Signer();
}
项目:gwt-crypto    文件:GOST3410Test.java   
public TestResult perform()
{
    BigInteger              r = new BigInteger("a8790aabbd5a998ff524bad048ac69cd1faff2dab048265c8d60d1471c44a9ee",16);
    BigInteger              s = new BigInteger("30df5ba32ac77170b9632559bef7d37620017756dff3fea1088b4267db0944b8",16);
    GOST3410ParametersGenerator  pGen = new GOST3410ParametersGenerator();

    pGen.init(1024, 1, init_random);

    GOST3410Parameters           params = pGen.generateParameters();

    if (!pValue.equals(params.getP()) || !qValue.equals(params.getQ()))
    {
        return new SimpleTestResult(false, getName() + ": p or q wrong");
    }

    GOST3410KeyPairGenerator         GOST3410KeyGen = new GOST3410KeyPairGenerator();
    GOST3410KeyGenerationParameters  genParam = new GOST3410KeyGenerationParameters(keyRandom, params);

    GOST3410KeyGen.init(genParam);

    AsymmetricCipherKeyPair  pair = GOST3410KeyGen.generateKeyPair();

    ParametersWithRandom param = new ParametersWithRandom(pair.getPrivate(), random);

    GOST3410Signer GOST3410 = new GOST3410Signer();

    GOST3410.init(true, param);

    BigInteger[] sig = GOST3410.generateSignature(hashmessage);

    if (!r.equals(sig[0]))
    {
        return new SimpleTestResult(false, getName()
            + ": r component wrong." + Strings.lineSeparator()
            + " expecting: " + r.toString(16) + Strings.lineSeparator()
            + " got      : " + sig[0].toString(16));
    }

    if (!s.equals(sig[1]))
    {
        return new SimpleTestResult(false, getName()
            + ": s component wrong." + Strings.lineSeparator()
            + " expecting: " + s.toString(16) + Strings.lineSeparator()
            + " got      : " + sig[1].toString(16));
    }

    GOST3410.init(false, pair.getPublic());

    if (GOST3410.verifySignature(hashmessage, sig[0], sig[1]))
    {
        return new SimpleTestResult(true, getName() + ": Okay");
    }
    else
    {
        return new SimpleTestResult(false, getName() + ": verification fails");
    }
}
项目:gwt-crypto    文件:GOST3410Test.java   
public TestResult perform()
{
    BigInteger              r = new BigInteger("81d69a192e9c7ac21fc07da41bd07e230ba6a94eb9f3c1fd104c7bd976733ca5",16);
    BigInteger              s = new BigInteger("315c879c8414f35feb4deb15e7cc0278c48e6ca1596325d6959338d860b0c47a",16);
    GOST3410ParametersGenerator  pGen = new GOST3410ParametersGenerator();

    pGen.init(1024, 2, init_random);

    GOST3410Parameters           params = pGen.generateParameters();

    if (!pValue.equals(params.getP()) || !qValue.equals(params.getQ()))
    {
        return new SimpleTestResult(false, getName() + ": p or q wrong");
    }

    GOST3410KeyPairGenerator         GOST3410KeyGen = new GOST3410KeyPairGenerator();
    GOST3410KeyGenerationParameters  genParam = new GOST3410KeyGenerationParameters(keyRandom, params);

    GOST3410KeyGen.init(genParam);

    AsymmetricCipherKeyPair  pair = GOST3410KeyGen.generateKeyPair();

    ParametersWithRandom param = new ParametersWithRandom(pair.getPrivate(), random);

    GOST3410Signer GOST3410 = new GOST3410Signer();

    GOST3410.init(true, param);

    BigInteger[] sig = GOST3410.generateSignature(hashmessage);

    if (!r.equals(sig[0]))
    {
        return new SimpleTestResult(false, getName()
            + ": r component wrong." + Strings.lineSeparator()
            + " expecting: " + r.toString(16) + Strings.lineSeparator()
            + " got      : " + sig[0].toString(16));
    }

    if (!s.equals(sig[1]))
    {
        return new SimpleTestResult(false, getName()
            + ": s component wrong." + Strings.lineSeparator()
            + " expecting: " + s.toString(16) + Strings.lineSeparator()
            + " got      : " + sig[1].toString(16));
    }

    GOST3410.init(false, pair.getPublic());

    if (GOST3410.verifySignature(hashmessage, sig[0], sig[1]))
    {
        return new SimpleTestResult(true, getName() + ": Okay");
    }
    else
    {
        return new SimpleTestResult(false, getName() + ": verification fails");
    }
}
项目:gwt-crypto    文件:GOST3410Test.java   
public TestResult perform()
{
    BigInteger              r = new BigInteger("64a8856628e5669d85f62cd763dd4a99bc56d33dc0e1859122855d141e9e4774",16);
    BigInteger              s = new BigInteger("319ebac97092b288d469a4b988248794f60c865bc97858d9a3135c6d1a1bf2dd",16);
    GOST3410ParametersGenerator  pGen = new GOST3410ParametersGenerator();

    pGen.init(1024, 2, init_random);

    GOST3410Parameters           params = pGen.generateParameters();

    if (!pValue.equals(params.getP()) || !qValue.equals(params.getQ()))
    {
        return new SimpleTestResult(false, getName() + ": p or q wrong");
    }

    GOST3410KeyPairGenerator         GOST3410KeyGen = new GOST3410KeyPairGenerator();
    GOST3410KeyGenerationParameters  genParam = new GOST3410KeyGenerationParameters(keyRandom, params);

    GOST3410KeyGen.init(genParam);

    AsymmetricCipherKeyPair  pair = GOST3410KeyGen.generateKeyPair();

    ParametersWithRandom param = new ParametersWithRandom(pair.getPrivate(), random);

    GOST3410Signer GOST3410 = new GOST3410Signer();

    GOST3410.init(true, param);

    BigInteger[] sig = GOST3410.generateSignature(hashmessage);

    if (!r.equals(sig[0]))
    {
        return new SimpleTestResult(false, getName()
            + ": r component wrong." + Strings.lineSeparator()
            + " expecting: " + r.toString(16) + Strings.lineSeparator()
            + " got      : " + sig[0].toString(16));
    }

    if (!s.equals(sig[1]))
    {
        return new SimpleTestResult(false, getName()
            + ": s component wrong." + Strings.lineSeparator()
            + " expecting: " + s.toString(16) + Strings.lineSeparator()
            + " got      : " + sig[1].toString(16));
    }

    GOST3410.init(false, pair.getPublic());

    if (GOST3410.verifySignature(hashmessage, sig[0], sig[1]))
    {
        return new SimpleTestResult(true, getName() + ": Okay");
    }
    else
    {
        return new SimpleTestResult(false, getName() + ": verification fails");
    }
}
项目:gwt-crypto    文件:GOST3410Test.java   
public TestResult perform()
{
    BigInteger              r = new BigInteger("860d82c60e9502cd00c0e9e1f6563feafec304801974d745c5e02079946f729e",16);
    BigInteger              s = new BigInteger("7ef49264ef022801aaa03033cd97915235fbab4c823ed936b0f360c22114688a",16);
    GOST3410ParametersGenerator  pGen = new GOST3410ParametersGenerator();

    pGen.init(1024, 2, init_random);

    GOST3410Parameters           params = pGen.generateParameters();

    if (!pValue.equals(params.getP()) || !qValue.equals(params.getQ()))
    {
        return new SimpleTestResult(false, getName() + ": p or q wrong");
    }

    GOST3410KeyPairGenerator         GOST3410KeyGen = new GOST3410KeyPairGenerator();
    GOST3410KeyGenerationParameters  genParam = new GOST3410KeyGenerationParameters(keyRandom, params);

    GOST3410KeyGen.init(genParam);

    AsymmetricCipherKeyPair  pair = GOST3410KeyGen.generateKeyPair();

    ParametersWithRandom param = new ParametersWithRandom(pair.getPrivate(), random);

    GOST3410Signer GOST3410 = new GOST3410Signer();

    GOST3410.init(true, param);

    BigInteger[] sig = GOST3410.generateSignature(hashmessage);

    if (!r.equals(sig[0]))
    {
        return new SimpleTestResult(false, getName()
            + ": r component wrong." + Strings.lineSeparator()
            + " expecting: " + r.toString(16) + Strings.lineSeparator()
            + " got      : " + sig[0].toString(16));
    }

    if (!s.equals(sig[1]))
    {
        return new SimpleTestResult(false, getName()
            + ": s component wrong." + Strings.lineSeparator()
            + " expecting: " + s.toString(16) + Strings.lineSeparator()
            + " got      : " + sig[1].toString(16));
    }

    GOST3410.init(false, pair.getPublic());

    if (GOST3410.verifySignature(hashmessage, sig[0], sig[1]))
    {
        return new SimpleTestResult(true, getName() + ": Okay");
    }
    else
    {
        return new SimpleTestResult(false, getName() + ": verification fails");
    }
}
项目:gwt-crypto    文件:GOST3410Test.java   
public TestResult perform()
{
    BigInteger              r = new BigInteger("4deb95a0b35e7ed7edebe9bef5a0f93739e16b7ff27fe794d989d0c13159cfbc",16);
    BigInteger              s = new BigInteger("e1d0d30345c24cfeb33efde3deee5fbbda78ddc822b719d860cd0ba1fb6bd43b",16);
    GOST3410ParametersGenerator  pGen = new GOST3410ParametersGenerator();

    pGen.init(1024, 2, init_random);

    GOST3410Parameters           params = pGen.generateParameters();

    if (!pValue.equals(params.getP()) || !qValue.equals(params.getQ()))
    {
        return new SimpleTestResult(false, getName() + ": p or q wrong");
    }

    GOST3410KeyPairGenerator         GOST3410KeyGen = new GOST3410KeyPairGenerator();
    GOST3410KeyGenerationParameters  genParam = new GOST3410KeyGenerationParameters(keyRandom, params);

    GOST3410KeyGen.init(genParam);

    AsymmetricCipherKeyPair  pair = GOST3410KeyGen.generateKeyPair();

    ParametersWithRandom param = new ParametersWithRandom(pair.getPrivate(), random);

    GOST3410Signer GOST3410 = new GOST3410Signer();

    GOST3410.init(true, param);

    BigInteger[] sig = GOST3410.generateSignature(hashmessage);

    if (!r.equals(sig[0]))
    {
        return new SimpleTestResult(false, getName()
            + ": r component wrong." + Strings.lineSeparator()
            + " expecting: " + r.toString(16) + Strings.lineSeparator()
            + " got      : " + sig[0].toString(16));
    }

    if (!s.equals(sig[1]))
    {
        return new SimpleTestResult(false, getName()
            + ": s component wrong." + Strings.lineSeparator()
            + " expecting: " + s.toString(16) + Strings.lineSeparator()
            + " got      : " + sig[1].toString(16));
    }

    GOST3410.init(false, pair.getPublic());

    if (GOST3410.verifySignature(hashmessage, sig[0], sig[1]))
    {
        return new SimpleTestResult(true, getName() + ": Okay");
    }
    else
    {
        return new SimpleTestResult(false, getName() + ": verification fails");
    }
}
项目:gwt-crypto    文件:GOST3410Test.java   
public TestResult perform()
{
    BigInteger              r = new BigInteger("712592d285b792e33b8a9a11e8e6c4f512ddf0042972bbfd1abb0a93e8fc6f54",16);
    BigInteger              s = new BigInteger("2cf26758321258b130d5612111339f09ceb8668241f3482e38baa56529963f07",16);
    GOST3410ParametersGenerator  pGen = new GOST3410ParametersGenerator();

    pGen.init(1024, 2, init_random);

    GOST3410Parameters           params = pGen.generateParameters();

    if (!pValue.equals(params.getP()) || !qValue.equals(params.getQ()))
    {
        return new SimpleTestResult(false, getName() + ": p or q wrong");
    }

    GOST3410KeyPairGenerator         GOST3410KeyGen = new GOST3410KeyPairGenerator();
    GOST3410KeyGenerationParameters  genParam = new GOST3410KeyGenerationParameters(keyRandom, params);

    GOST3410KeyGen.init(genParam);

    AsymmetricCipherKeyPair  pair = GOST3410KeyGen.generateKeyPair();

    ParametersWithRandom param = new ParametersWithRandom(pair.getPrivate(), random);

    GOST3410Signer GOST3410 = new GOST3410Signer();

    GOST3410.init(true, param);

    BigInteger[] sig = GOST3410.generateSignature(hashmessage);

    if (!r.equals(sig[0]))
    {
        return new SimpleTestResult(false, getName()
            + ": r component wrong." + Strings.lineSeparator()
            + " expecting: " + r.toString(16) + Strings.lineSeparator()
            + " got      : " + sig[0].toString(16));
    }

    if (!s.equals(sig[1]))
    {
        return new SimpleTestResult(false, getName()
            + ": s component wrong." + Strings.lineSeparator()
            + " expecting: " + s.toString(16) + Strings.lineSeparator()
            + " got      : " + sig[1].toString(16));
    }

    GOST3410.init(false, pair.getPublic());

    if (GOST3410.verifySignature(hashmessage, sig[0], sig[1]))
    {
        return new SimpleTestResult(true, getName() + ": Okay");
    }
    else
    {
        return new SimpleTestResult(false, getName() + ": verification fails");
    }
}
项目:gwt-crypto    文件:GOST3410Test.java   
public TestResult perform()
{
    BigInteger              r = new BigInteger("90892707282f433398488f19d31ac48523a8e2ded68944e0da91c6895ee7045e",16);
    BigInteger              s = new BigInteger("3be4620ee88f1ee8f9dd63c7d145b7e554839feeca125049118262ea4651e9de",16);
    GOST3410ParametersGenerator  pGen = new GOST3410ParametersGenerator();

    pGen.init(1024, 2, init_random);

    GOST3410Parameters           params = pGen.generateParameters();

    if (!pValue.equals(params.getP()) || !qValue.equals(params.getQ()))
    {
        return new SimpleTestResult(false, getName() + ": p or q wrong");
    }

    GOST3410KeyPairGenerator         GOST3410KeyGen = new GOST3410KeyPairGenerator();
    GOST3410KeyGenerationParameters  genParam = new GOST3410KeyGenerationParameters(keyRandom, params);

    GOST3410KeyGen.init(genParam);

    AsymmetricCipherKeyPair  pair = GOST3410KeyGen.generateKeyPair();

    ParametersWithRandom param = new ParametersWithRandom(pair.getPrivate(), random);

    GOST3410Signer GOST3410 = new GOST3410Signer();

    GOST3410.init(true, param);

    BigInteger[] sig = GOST3410.generateSignature(hashmessage);

    if (!r.equals(sig[0]))
    {
        return new SimpleTestResult(false, getName()
            + ": r component wrong." + Strings.lineSeparator()
            + " expecting: " + r.toString(16) + Strings.lineSeparator()
            + " got      : " + sig[0].toString(16));
    }

    if (!s.equals(sig[1]))
    {
        return new SimpleTestResult(false, getName()
            + ": s component wrong." + Strings.lineSeparator()
            + " expecting: " + s.toString(16) + Strings.lineSeparator()
            + " got      : " + sig[1].toString(16));
    }

    GOST3410.init(false, pair.getPublic());

    if (GOST3410.verifySignature(hashmessage, sig[0], sig[1]))
    {
        return new SimpleTestResult(true, getName() + ": Okay");
    }
    else
    {
        return new SimpleTestResult(false, getName() + ": verification fails");
    }
}
项目:gwt-crypto    文件:GOST3410Test.java   
public TestResult perform()
{
    BigInteger              r = new BigInteger("8f79a582513df84dc247bcb624340cc0e5a34c4324a20ce7fe3ab8ff38a9db71",16);
    BigInteger              s = new BigInteger("7508d22fd6cbb45efd438cb875e43f137247088d0f54b29a7c91f68a65b5fa85",16);
    GOST3410ParametersGenerator  pGen = new GOST3410ParametersGenerator();

    pGen.init(1024, 2, init_random);

    GOST3410Parameters           params = pGen.generateParameters();

    if (!pValue.equals(params.getP()) || !qValue.equals(params.getQ()))
    {
        return new SimpleTestResult(false, getName() + ": p or q wrong");
    }

    GOST3410KeyPairGenerator         GOST3410KeyGen = new GOST3410KeyPairGenerator();
    GOST3410KeyGenerationParameters  genParam = new GOST3410KeyGenerationParameters(keyRandom, params);

    GOST3410KeyGen.init(genParam);

    AsymmetricCipherKeyPair  pair = GOST3410KeyGen.generateKeyPair();

    ParametersWithRandom param = new ParametersWithRandom(pair.getPrivate(), random);

    GOST3410Signer GOST3410 = new GOST3410Signer();

    GOST3410.init(true, param);

    BigInteger[] sig = GOST3410.generateSignature(hashmessage);

    if (!r.equals(sig[0]))
    {
        return new SimpleTestResult(false, getName()
            + ": r component wrong." + Strings.lineSeparator()
            + " expecting: " + r.toString(16) + Strings.lineSeparator()
            + " got      : " + sig[0].toString(16));
    }

    if (!s.equals(sig[1]))
    {
        return new SimpleTestResult(false, getName()
            + ": s component wrong." + Strings.lineSeparator()
            + " expecting: " + s.toString(16) + Strings.lineSeparator()
            + " got      : " + sig[1].toString(16));
    }

    GOST3410.init(false, pair.getPublic());

    if (GOST3410.verifySignature(hashmessage, sig[0], sig[1]))
    {
        return new SimpleTestResult(true, getName() + ": Okay");
    }
    else
    {
        return new SimpleTestResult(false, getName() + ": verification fails");
    }
}
项目:gwt-crypto    文件:GOST3410Test.java   
public TestResult perform()
{
    BigInteger              r = new BigInteger("169fdb2dc09f690b71332432bfec806042e258fa9a21dafe73c6abfbc71407d9",16);
    BigInteger              s = new BigInteger("9002551808ae40d19f6f31fb67e4563101243cf07cffd5f2f8ff4c537b0c9866",16);
    GOST3410ParametersGenerator  pGen = new GOST3410ParametersGenerator();

    pGen.init(1024, 2, init_random);

    GOST3410Parameters           params = pGen.generateParameters();

    if (!pValue.equals(params.getP()) || !qValue.equals(params.getQ()))
    {
        return new SimpleTestResult(false, getName() + ": p or q wrong");
    }

    GOST3410KeyPairGenerator         GOST3410KeyGen = new GOST3410KeyPairGenerator();
    GOST3410KeyGenerationParameters  genParam = new GOST3410KeyGenerationParameters(keyRandom, params);

    GOST3410KeyGen.init(genParam);

    AsymmetricCipherKeyPair  pair = GOST3410KeyGen.generateKeyPair();

    ParametersWithRandom param = new ParametersWithRandom(pair.getPrivate(), random);

    GOST3410Signer GOST3410 = new GOST3410Signer();

    GOST3410.init(true, param);

    BigInteger[] sig = GOST3410.generateSignature(hashmessage);

    if (!r.equals(sig[0]))
    {
        return new SimpleTestResult(false, getName()
            + ": r component wrong." + Strings.lineSeparator()
            + " expecting: " + r.toString(16) + Strings.lineSeparator()
            + " got      : " + sig[0].toString(16));
    }

    if (!s.equals(sig[1]))
    {
        return new SimpleTestResult(false, getName()
            + ": s component wrong." + Strings.lineSeparator()
            + " expecting: " + s.toString(16) + Strings.lineSeparator()
            + " got      : " + sig[1].toString(16));
    }

    GOST3410.init(false, pair.getPublic());

    if (GOST3410.verifySignature(hashmessage, sig[0], sig[1]))
    {
        return new SimpleTestResult(true, getName() + ": Okay");
    }
    else
    {
        return new SimpleTestResult(false, getName() + ": verification fails");
    }
}
项目:Aki-SSL    文件:SignatureSpi.java   
public SignatureSpi()
{
    this.digest = new GOST3411Digest();
    this.signer = new GOST3410Signer();
}
项目:CryptMeme    文件:SignatureSpi.java   
public SignatureSpi()
{
    this.digest = new GOST3411Digest();
    this.signer = new GOST3410Signer();
}
项目:irma_future_id    文件:GOST3410Test.java   
public TestResult perform()
{
    BigInteger              r = new BigInteger("a8790aabbd5a998ff524bad048ac69cd1faff2dab048265c8d60d1471c44a9ee",16);
    BigInteger              s = new BigInteger("30df5ba32ac77170b9632559bef7d37620017756dff3fea1088b4267db0944b8",16);
    GOST3410ParametersGenerator  pGen = new GOST3410ParametersGenerator();

    pGen.init(1024, 1, init_random);

    GOST3410Parameters           params = pGen.generateParameters();

    if (!pValue.equals(params.getP()) || !qValue.equals(params.getQ()))
    {
        return new SimpleTestResult(false, getName() + ": p or q wrong");
    }

    GOST3410KeyPairGenerator         GOST3410KeyGen = new GOST3410KeyPairGenerator();
    GOST3410KeyGenerationParameters  genParam = new GOST3410KeyGenerationParameters(keyRandom, params);

    GOST3410KeyGen.init(genParam);

    AsymmetricCipherKeyPair  pair = GOST3410KeyGen.generateKeyPair();

    ParametersWithRandom param = new ParametersWithRandom(pair.getPrivate(), random);

    GOST3410Signer GOST3410 = new GOST3410Signer();

    GOST3410.init(true, param);

    BigInteger[] sig = GOST3410.generateSignature(hashmessage);

    if (!r.equals(sig[0]))
    {
        return new SimpleTestResult(false, getName()
            + ": r component wrong." + System.getProperty("line.separator")
            + " expecting: " + r.toString(16) + System.getProperty("line.separator")
            + " got      : " + sig[0].toString(16));
    }

    if (!s.equals(sig[1]))
    {
        return new SimpleTestResult(false, getName()
            + ": s component wrong." + System.getProperty("line.separator")
            + " expecting: " + s.toString(16) + System.getProperty("line.separator")
            + " got      : " + sig[1].toString(16));
    }

    GOST3410.init(false, pair.getPublic());

    if (GOST3410.verifySignature(hashmessage, sig[0], sig[1]))
    {
        return new SimpleTestResult(true, getName() + ": Okay");
    }
    else
    {
        return new SimpleTestResult(false, getName() + ": verification fails");
    }
}
项目:irma_future_id    文件:GOST3410Test.java   
public TestResult perform()
{
    BigInteger              r = new BigInteger("81d69a192e9c7ac21fc07da41bd07e230ba6a94eb9f3c1fd104c7bd976733ca5",16);
    BigInteger              s = new BigInteger("315c879c8414f35feb4deb15e7cc0278c48e6ca1596325d6959338d860b0c47a",16);
    GOST3410ParametersGenerator  pGen = new GOST3410ParametersGenerator();

    pGen.init(1024, 2, init_random);

    GOST3410Parameters           params = pGen.generateParameters();

    if (!pValue.equals(params.getP()) || !qValue.equals(params.getQ()))
    {
        return new SimpleTestResult(false, getName() + ": p or q wrong");
    }

    GOST3410KeyPairGenerator         GOST3410KeyGen = new GOST3410KeyPairGenerator();
    GOST3410KeyGenerationParameters  genParam = new GOST3410KeyGenerationParameters(keyRandom, params);

    GOST3410KeyGen.init(genParam);

    AsymmetricCipherKeyPair  pair = GOST3410KeyGen.generateKeyPair();

    ParametersWithRandom param = new ParametersWithRandom(pair.getPrivate(), random);

    GOST3410Signer GOST3410 = new GOST3410Signer();

    GOST3410.init(true, param);

    BigInteger[] sig = GOST3410.generateSignature(hashmessage);

    if (!r.equals(sig[0]))
    {
        return new SimpleTestResult(false, getName()
            + ": r component wrong." + System.getProperty("line.separator")
            + " expecting: " + r.toString(16) + System.getProperty("line.separator")
            + " got      : " + sig[0].toString(16));
    }

    if (!s.equals(sig[1]))
    {
        return new SimpleTestResult(false, getName()
            + ": s component wrong." + System.getProperty("line.separator")
            + " expecting: " + s.toString(16) + System.getProperty("line.separator")
            + " got      : " + sig[1].toString(16));
    }

    GOST3410.init(false, pair.getPublic());

    if (GOST3410.verifySignature(hashmessage, sig[0], sig[1]))
    {
        return new SimpleTestResult(true, getName() + ": Okay");
    }
    else
    {
        return new SimpleTestResult(false, getName() + ": verification fails");
    }
}
项目:irma_future_id    文件:GOST3410Test.java   
public TestResult perform()
{
    BigInteger              r = new BigInteger("64a8856628e5669d85f62cd763dd4a99bc56d33dc0e1859122855d141e9e4774",16);
    BigInteger              s = new BigInteger("319ebac97092b288d469a4b988248794f60c865bc97858d9a3135c6d1a1bf2dd",16);
    GOST3410ParametersGenerator  pGen = new GOST3410ParametersGenerator();

    pGen.init(1024, 2, init_random);

    GOST3410Parameters           params = pGen.generateParameters();

    if (!pValue.equals(params.getP()) || !qValue.equals(params.getQ()))
    {
        return new SimpleTestResult(false, getName() + ": p or q wrong");
    }

    GOST3410KeyPairGenerator         GOST3410KeyGen = new GOST3410KeyPairGenerator();
    GOST3410KeyGenerationParameters  genParam = new GOST3410KeyGenerationParameters(keyRandom, params);

    GOST3410KeyGen.init(genParam);

    AsymmetricCipherKeyPair  pair = GOST3410KeyGen.generateKeyPair();

    ParametersWithRandom param = new ParametersWithRandom(pair.getPrivate(), random);

    GOST3410Signer GOST3410 = new GOST3410Signer();

    GOST3410.init(true, param);

    BigInteger[] sig = GOST3410.generateSignature(hashmessage);

    if (!r.equals(sig[0]))
    {
        return new SimpleTestResult(false, getName()
            + ": r component wrong." + System.getProperty("line.separator")
            + " expecting: " + r.toString(16) + System.getProperty("line.separator")
            + " got      : " + sig[0].toString(16));
    }

    if (!s.equals(sig[1]))
    {
        return new SimpleTestResult(false, getName()
            + ": s component wrong." + System.getProperty("line.separator")
            + " expecting: " + s.toString(16) + System.getProperty("line.separator")
            + " got      : " + sig[1].toString(16));
    }

    GOST3410.init(false, pair.getPublic());

    if (GOST3410.verifySignature(hashmessage, sig[0], sig[1]))
    {
        return new SimpleTestResult(true, getName() + ": Okay");
    }
    else
    {
        return new SimpleTestResult(false, getName() + ": verification fails");
    }
}
项目:irma_future_id    文件:GOST3410Test.java   
public TestResult perform()
{
    BigInteger              r = new BigInteger("860d82c60e9502cd00c0e9e1f6563feafec304801974d745c5e02079946f729e",16);
    BigInteger              s = new BigInteger("7ef49264ef022801aaa03033cd97915235fbab4c823ed936b0f360c22114688a",16);
    GOST3410ParametersGenerator  pGen = new GOST3410ParametersGenerator();

    pGen.init(1024, 2, init_random);

    GOST3410Parameters           params = pGen.generateParameters();

    if (!pValue.equals(params.getP()) || !qValue.equals(params.getQ()))
    {
        return new SimpleTestResult(false, getName() + ": p or q wrong");
    }

    GOST3410KeyPairGenerator         GOST3410KeyGen = new GOST3410KeyPairGenerator();
    GOST3410KeyGenerationParameters  genParam = new GOST3410KeyGenerationParameters(keyRandom, params);

    GOST3410KeyGen.init(genParam);

    AsymmetricCipherKeyPair  pair = GOST3410KeyGen.generateKeyPair();

    ParametersWithRandom param = new ParametersWithRandom(pair.getPrivate(), random);

    GOST3410Signer GOST3410 = new GOST3410Signer();

    GOST3410.init(true, param);

    BigInteger[] sig = GOST3410.generateSignature(hashmessage);

    if (!r.equals(sig[0]))
    {
        return new SimpleTestResult(false, getName()
            + ": r component wrong." + System.getProperty("line.separator")
            + " expecting: " + r.toString(16) + System.getProperty("line.separator")
            + " got      : " + sig[0].toString(16));
    }

    if (!s.equals(sig[1]))
    {
        return new SimpleTestResult(false, getName()
            + ": s component wrong." + System.getProperty("line.separator")
            + " expecting: " + s.toString(16) + System.getProperty("line.separator")
            + " got      : " + sig[1].toString(16));
    }

    GOST3410.init(false, pair.getPublic());

    if (GOST3410.verifySignature(hashmessage, sig[0], sig[1]))
    {
        return new SimpleTestResult(true, getName() + ": Okay");
    }
    else
    {
        return new SimpleTestResult(false, getName() + ": verification fails");
    }
}
项目:irma_future_id    文件:GOST3410Test.java   
public TestResult perform()
{
    BigInteger              r = new BigInteger("4deb95a0b35e7ed7edebe9bef5a0f93739e16b7ff27fe794d989d0c13159cfbc",16);
    BigInteger              s = new BigInteger("e1d0d30345c24cfeb33efde3deee5fbbda78ddc822b719d860cd0ba1fb6bd43b",16);
    GOST3410ParametersGenerator  pGen = new GOST3410ParametersGenerator();

    pGen.init(1024, 2, init_random);

    GOST3410Parameters           params = pGen.generateParameters();

    if (!pValue.equals(params.getP()) || !qValue.equals(params.getQ()))
    {
        return new SimpleTestResult(false, getName() + ": p or q wrong");
    }

    GOST3410KeyPairGenerator         GOST3410KeyGen = new GOST3410KeyPairGenerator();
    GOST3410KeyGenerationParameters  genParam = new GOST3410KeyGenerationParameters(keyRandom, params);

    GOST3410KeyGen.init(genParam);

    AsymmetricCipherKeyPair  pair = GOST3410KeyGen.generateKeyPair();

    ParametersWithRandom param = new ParametersWithRandom(pair.getPrivate(), random);

    GOST3410Signer GOST3410 = new GOST3410Signer();

    GOST3410.init(true, param);

    BigInteger[] sig = GOST3410.generateSignature(hashmessage);

    if (!r.equals(sig[0]))
    {
        return new SimpleTestResult(false, getName()
            + ": r component wrong." + System.getProperty("line.separator")
            + " expecting: " + r.toString(16) + System.getProperty("line.separator")
            + " got      : " + sig[0].toString(16));
    }

    if (!s.equals(sig[1]))
    {
        return new SimpleTestResult(false, getName()
            + ": s component wrong." + System.getProperty("line.separator")
            + " expecting: " + s.toString(16) + System.getProperty("line.separator")
            + " got      : " + sig[1].toString(16));
    }

    GOST3410.init(false, pair.getPublic());

    if (GOST3410.verifySignature(hashmessage, sig[0], sig[1]))
    {
        return new SimpleTestResult(true, getName() + ": Okay");
    }
    else
    {
        return new SimpleTestResult(false, getName() + ": verification fails");
    }
}
项目:irma_future_id    文件:GOST3410Test.java   
public TestResult perform()
{
    BigInteger              r = new BigInteger("712592d285b792e33b8a9a11e8e6c4f512ddf0042972bbfd1abb0a93e8fc6f54",16);
    BigInteger              s = new BigInteger("2cf26758321258b130d5612111339f09ceb8668241f3482e38baa56529963f07",16);
    GOST3410ParametersGenerator  pGen = new GOST3410ParametersGenerator();

    pGen.init(1024, 2, init_random);

    GOST3410Parameters           params = pGen.generateParameters();

    if (!pValue.equals(params.getP()) || !qValue.equals(params.getQ()))
    {
        return new SimpleTestResult(false, getName() + ": p or q wrong");
    }

    GOST3410KeyPairGenerator         GOST3410KeyGen = new GOST3410KeyPairGenerator();
    GOST3410KeyGenerationParameters  genParam = new GOST3410KeyGenerationParameters(keyRandom, params);

    GOST3410KeyGen.init(genParam);

    AsymmetricCipherKeyPair  pair = GOST3410KeyGen.generateKeyPair();

    ParametersWithRandom param = new ParametersWithRandom(pair.getPrivate(), random);

    GOST3410Signer GOST3410 = new GOST3410Signer();

    GOST3410.init(true, param);

    BigInteger[] sig = GOST3410.generateSignature(hashmessage);

    if (!r.equals(sig[0]))
    {
        return new SimpleTestResult(false, getName()
            + ": r component wrong." + System.getProperty("line.separator")
            + " expecting: " + r.toString(16) + System.getProperty("line.separator")
            + " got      : " + sig[0].toString(16));
    }

    if (!s.equals(sig[1]))
    {
        return new SimpleTestResult(false, getName()
            + ": s component wrong." + System.getProperty("line.separator")
            + " expecting: " + s.toString(16) + System.getProperty("line.separator")
            + " got      : " + sig[1].toString(16));
    }

    GOST3410.init(false, pair.getPublic());

    if (GOST3410.verifySignature(hashmessage, sig[0], sig[1]))
    {
        return new SimpleTestResult(true, getName() + ": Okay");
    }
    else
    {
        return new SimpleTestResult(false, getName() + ": verification fails");
    }
}
项目:irma_future_id    文件:GOST3410Test.java   
public TestResult perform()
{
    BigInteger              r = new BigInteger("90892707282f433398488f19d31ac48523a8e2ded68944e0da91c6895ee7045e",16);
    BigInteger              s = new BigInteger("3be4620ee88f1ee8f9dd63c7d145b7e554839feeca125049118262ea4651e9de",16);
    GOST3410ParametersGenerator  pGen = new GOST3410ParametersGenerator();

    pGen.init(1024, 2, init_random);

    GOST3410Parameters           params = pGen.generateParameters();

    if (!pValue.equals(params.getP()) || !qValue.equals(params.getQ()))
    {
        return new SimpleTestResult(false, getName() + ": p or q wrong");
    }

    GOST3410KeyPairGenerator         GOST3410KeyGen = new GOST3410KeyPairGenerator();
    GOST3410KeyGenerationParameters  genParam = new GOST3410KeyGenerationParameters(keyRandom, params);

    GOST3410KeyGen.init(genParam);

    AsymmetricCipherKeyPair  pair = GOST3410KeyGen.generateKeyPair();

    ParametersWithRandom param = new ParametersWithRandom(pair.getPrivate(), random);

    GOST3410Signer GOST3410 = new GOST3410Signer();

    GOST3410.init(true, param);

    BigInteger[] sig = GOST3410.generateSignature(hashmessage);

    if (!r.equals(sig[0]))
    {
        return new SimpleTestResult(false, getName()
            + ": r component wrong." + System.getProperty("line.separator")
            + " expecting: " + r.toString(16) + System.getProperty("line.separator")
            + " got      : " + sig[0].toString(16));
    }

    if (!s.equals(sig[1]))
    {
        return new SimpleTestResult(false, getName()
            + ": s component wrong." + System.getProperty("line.separator")
            + " expecting: " + s.toString(16) + System.getProperty("line.separator")
            + " got      : " + sig[1].toString(16));
    }

    GOST3410.init(false, pair.getPublic());

    if (GOST3410.verifySignature(hashmessage, sig[0], sig[1]))
    {
        return new SimpleTestResult(true, getName() + ": Okay");
    }
    else
    {
        return new SimpleTestResult(false, getName() + ": verification fails");
    }
}
项目:irma_future_id    文件:GOST3410Test.java   
public TestResult perform()
{
    BigInteger              r = new BigInteger("8f79a582513df84dc247bcb624340cc0e5a34c4324a20ce7fe3ab8ff38a9db71",16);
    BigInteger              s = new BigInteger("7508d22fd6cbb45efd438cb875e43f137247088d0f54b29a7c91f68a65b5fa85",16);
    GOST3410ParametersGenerator  pGen = new GOST3410ParametersGenerator();

    pGen.init(1024, 2, init_random);

    GOST3410Parameters           params = pGen.generateParameters();

    if (!pValue.equals(params.getP()) || !qValue.equals(params.getQ()))
    {
        return new SimpleTestResult(false, getName() + ": p or q wrong");
    }

    GOST3410KeyPairGenerator         GOST3410KeyGen = new GOST3410KeyPairGenerator();
    GOST3410KeyGenerationParameters  genParam = new GOST3410KeyGenerationParameters(keyRandom, params);

    GOST3410KeyGen.init(genParam);

    AsymmetricCipherKeyPair  pair = GOST3410KeyGen.generateKeyPair();

    ParametersWithRandom param = new ParametersWithRandom(pair.getPrivate(), random);

    GOST3410Signer GOST3410 = new GOST3410Signer();

    GOST3410.init(true, param);

    BigInteger[] sig = GOST3410.generateSignature(hashmessage);

    if (!r.equals(sig[0]))
    {
        return new SimpleTestResult(false, getName()
            + ": r component wrong." + System.getProperty("line.separator")
            + " expecting: " + r.toString(16) + System.getProperty("line.separator")
            + " got      : " + sig[0].toString(16));
    }

    if (!s.equals(sig[1]))
    {
        return new SimpleTestResult(false, getName()
            + ": s component wrong." + System.getProperty("line.separator")
            + " expecting: " + s.toString(16) + System.getProperty("line.separator")
            + " got      : " + sig[1].toString(16));
    }

    GOST3410.init(false, pair.getPublic());

    if (GOST3410.verifySignature(hashmessage, sig[0], sig[1]))
    {
        return new SimpleTestResult(true, getName() + ": Okay");
    }
    else
    {
        return new SimpleTestResult(false, getName() + ": verification fails");
    }
}
项目:irma_future_id    文件:GOST3410Test.java   
public TestResult perform()
{
    BigInteger              r = new BigInteger("169fdb2dc09f690b71332432bfec806042e258fa9a21dafe73c6abfbc71407d9",16);
    BigInteger              s = new BigInteger("9002551808ae40d19f6f31fb67e4563101243cf07cffd5f2f8ff4c537b0c9866",16);
    GOST3410ParametersGenerator  pGen = new GOST3410ParametersGenerator();

    pGen.init(1024, 2, init_random);

    GOST3410Parameters           params = pGen.generateParameters();

    if (!pValue.equals(params.getP()) || !qValue.equals(params.getQ()))
    {
        return new SimpleTestResult(false, getName() + ": p or q wrong");
    }

    GOST3410KeyPairGenerator         GOST3410KeyGen = new GOST3410KeyPairGenerator();
    GOST3410KeyGenerationParameters  genParam = new GOST3410KeyGenerationParameters(keyRandom, params);

    GOST3410KeyGen.init(genParam);

    AsymmetricCipherKeyPair  pair = GOST3410KeyGen.generateKeyPair();

    ParametersWithRandom param = new ParametersWithRandom(pair.getPrivate(), random);

    GOST3410Signer GOST3410 = new GOST3410Signer();

    GOST3410.init(true, param);

    BigInteger[] sig = GOST3410.generateSignature(hashmessage);

    if (!r.equals(sig[0]))
    {
        return new SimpleTestResult(false, getName()
            + ": r component wrong." + System.getProperty("line.separator")
            + " expecting: " + r.toString(16) + System.getProperty("line.separator")
            + " got      : " + sig[0].toString(16));
    }

    if (!s.equals(sig[1]))
    {
        return new SimpleTestResult(false, getName()
            + ": s component wrong." + System.getProperty("line.separator")
            + " expecting: " + s.toString(16) + System.getProperty("line.separator")
            + " got      : " + sig[1].toString(16));
    }

    GOST3410.init(false, pair.getPublic());

    if (GOST3410.verifySignature(hashmessage, sig[0], sig[1]))
    {
        return new SimpleTestResult(true, getName() + ": Okay");
    }
    else
    {
        return new SimpleTestResult(false, getName() + ": verification fails");
    }
}
项目:irma_future_id    文件:SignatureSpi.java   
public SignatureSpi()
{
    this.digest = new GOST3411Digest();
    this.signer = new GOST3410Signer();
}
项目:irma_future_id    文件:SignatureSpi.java   
public SignatureSpi()
{
    super("GOST3410");
    this.digest = new GOST3411Digest();
    this.signer = new GOST3410Signer();
}
项目:bc-java    文件:GOST3410Test.java   
public TestResult perform()
{
    BigInteger              r = new BigInteger("a8790aabbd5a998ff524bad048ac69cd1faff2dab048265c8d60d1471c44a9ee",16);
    BigInteger              s = new BigInteger("30df5ba32ac77170b9632559bef7d37620017756dff3fea1088b4267db0944b8",16);
    GOST3410ParametersGenerator  pGen = new GOST3410ParametersGenerator();

    pGen.init(1024, 1, init_random);

    GOST3410Parameters           params = pGen.generateParameters();

    if (!pValue.equals(params.getP()) || !qValue.equals(params.getQ()))
    {
        return new SimpleTestResult(false, getName() + ": p or q wrong");
    }

    GOST3410KeyPairGenerator         GOST3410KeyGen = new GOST3410KeyPairGenerator();
    GOST3410KeyGenerationParameters  genParam = new GOST3410KeyGenerationParameters(keyRandom, params);

    GOST3410KeyGen.init(genParam);

    AsymmetricCipherKeyPair  pair = GOST3410KeyGen.generateKeyPair();

    ParametersWithRandom param = new ParametersWithRandom(pair.getPrivate(), random);

    GOST3410Signer GOST3410 = new GOST3410Signer();

    GOST3410.init(true, param);

    BigInteger[] sig = GOST3410.generateSignature(hashmessage);

    if (!r.equals(sig[0]))
    {
        return new SimpleTestResult(false, getName()
            + ": r component wrong." + System.getProperty("line.separator")
            + " expecting: " + r.toString(16) + System.getProperty("line.separator")
            + " got      : " + sig[0].toString(16));
    }

    if (!s.equals(sig[1]))
    {
        return new SimpleTestResult(false, getName()
            + ": s component wrong." + System.getProperty("line.separator")
            + " expecting: " + s.toString(16) + System.getProperty("line.separator")
            + " got      : " + sig[1].toString(16));
    }

    GOST3410.init(false, pair.getPublic());

    if (GOST3410.verifySignature(hashmessage, sig[0], sig[1]))
    {
        return new SimpleTestResult(true, getName() + ": Okay");
    }
    else
    {
        return new SimpleTestResult(false, getName() + ": verification fails");
    }
}
项目:bc-java    文件:GOST3410Test.java   
public TestResult perform()
{
    BigInteger              r = new BigInteger("81d69a192e9c7ac21fc07da41bd07e230ba6a94eb9f3c1fd104c7bd976733ca5",16);
    BigInteger              s = new BigInteger("315c879c8414f35feb4deb15e7cc0278c48e6ca1596325d6959338d860b0c47a",16);
    GOST3410ParametersGenerator  pGen = new GOST3410ParametersGenerator();

    pGen.init(1024, 2, init_random);

    GOST3410Parameters           params = pGen.generateParameters();

    if (!pValue.equals(params.getP()) || !qValue.equals(params.getQ()))
    {
        return new SimpleTestResult(false, getName() + ": p or q wrong");
    }

    GOST3410KeyPairGenerator         GOST3410KeyGen = new GOST3410KeyPairGenerator();
    GOST3410KeyGenerationParameters  genParam = new GOST3410KeyGenerationParameters(keyRandom, params);

    GOST3410KeyGen.init(genParam);

    AsymmetricCipherKeyPair  pair = GOST3410KeyGen.generateKeyPair();

    ParametersWithRandom param = new ParametersWithRandom(pair.getPrivate(), random);

    GOST3410Signer GOST3410 = new GOST3410Signer();

    GOST3410.init(true, param);

    BigInteger[] sig = GOST3410.generateSignature(hashmessage);

    if (!r.equals(sig[0]))
    {
        return new SimpleTestResult(false, getName()
            + ": r component wrong." + System.getProperty("line.separator")
            + " expecting: " + r.toString(16) + System.getProperty("line.separator")
            + " got      : " + sig[0].toString(16));
    }

    if (!s.equals(sig[1]))
    {
        return new SimpleTestResult(false, getName()
            + ": s component wrong." + System.getProperty("line.separator")
            + " expecting: " + s.toString(16) + System.getProperty("line.separator")
            + " got      : " + sig[1].toString(16));
    }

    GOST3410.init(false, pair.getPublic());

    if (GOST3410.verifySignature(hashmessage, sig[0], sig[1]))
    {
        return new SimpleTestResult(true, getName() + ": Okay");
    }
    else
    {
        return new SimpleTestResult(false, getName() + ": verification fails");
    }
}
项目:bc-java    文件:GOST3410Test.java   
public TestResult perform()
{
    BigInteger              r = new BigInteger("64a8856628e5669d85f62cd763dd4a99bc56d33dc0e1859122855d141e9e4774",16);
    BigInteger              s = new BigInteger("319ebac97092b288d469a4b988248794f60c865bc97858d9a3135c6d1a1bf2dd",16);
    GOST3410ParametersGenerator  pGen = new GOST3410ParametersGenerator();

    pGen.init(1024, 2, init_random);

    GOST3410Parameters           params = pGen.generateParameters();

    if (!pValue.equals(params.getP()) || !qValue.equals(params.getQ()))
    {
        return new SimpleTestResult(false, getName() + ": p or q wrong");
    }

    GOST3410KeyPairGenerator         GOST3410KeyGen = new GOST3410KeyPairGenerator();
    GOST3410KeyGenerationParameters  genParam = new GOST3410KeyGenerationParameters(keyRandom, params);

    GOST3410KeyGen.init(genParam);

    AsymmetricCipherKeyPair  pair = GOST3410KeyGen.generateKeyPair();

    ParametersWithRandom param = new ParametersWithRandom(pair.getPrivate(), random);

    GOST3410Signer GOST3410 = new GOST3410Signer();

    GOST3410.init(true, param);

    BigInteger[] sig = GOST3410.generateSignature(hashmessage);

    if (!r.equals(sig[0]))
    {
        return new SimpleTestResult(false, getName()
            + ": r component wrong." + System.getProperty("line.separator")
            + " expecting: " + r.toString(16) + System.getProperty("line.separator")
            + " got      : " + sig[0].toString(16));
    }

    if (!s.equals(sig[1]))
    {
        return new SimpleTestResult(false, getName()
            + ": s component wrong." + System.getProperty("line.separator")
            + " expecting: " + s.toString(16) + System.getProperty("line.separator")
            + " got      : " + sig[1].toString(16));
    }

    GOST3410.init(false, pair.getPublic());

    if (GOST3410.verifySignature(hashmessage, sig[0], sig[1]))
    {
        return new SimpleTestResult(true, getName() + ": Okay");
    }
    else
    {
        return new SimpleTestResult(false, getName() + ": verification fails");
    }
}
项目:bc-java    文件:GOST3410Test.java   
public TestResult perform()
{
    BigInteger              r = new BigInteger("860d82c60e9502cd00c0e9e1f6563feafec304801974d745c5e02079946f729e",16);
    BigInteger              s = new BigInteger("7ef49264ef022801aaa03033cd97915235fbab4c823ed936b0f360c22114688a",16);
    GOST3410ParametersGenerator  pGen = new GOST3410ParametersGenerator();

    pGen.init(1024, 2, init_random);

    GOST3410Parameters           params = pGen.generateParameters();

    if (!pValue.equals(params.getP()) || !qValue.equals(params.getQ()))
    {
        return new SimpleTestResult(false, getName() + ": p or q wrong");
    }

    GOST3410KeyPairGenerator         GOST3410KeyGen = new GOST3410KeyPairGenerator();
    GOST3410KeyGenerationParameters  genParam = new GOST3410KeyGenerationParameters(keyRandom, params);

    GOST3410KeyGen.init(genParam);

    AsymmetricCipherKeyPair  pair = GOST3410KeyGen.generateKeyPair();

    ParametersWithRandom param = new ParametersWithRandom(pair.getPrivate(), random);

    GOST3410Signer GOST3410 = new GOST3410Signer();

    GOST3410.init(true, param);

    BigInteger[] sig = GOST3410.generateSignature(hashmessage);

    if (!r.equals(sig[0]))
    {
        return new SimpleTestResult(false, getName()
            + ": r component wrong." + System.getProperty("line.separator")
            + " expecting: " + r.toString(16) + System.getProperty("line.separator")
            + " got      : " + sig[0].toString(16));
    }

    if (!s.equals(sig[1]))
    {
        return new SimpleTestResult(false, getName()
            + ": s component wrong." + System.getProperty("line.separator")
            + " expecting: " + s.toString(16) + System.getProperty("line.separator")
            + " got      : " + sig[1].toString(16));
    }

    GOST3410.init(false, pair.getPublic());

    if (GOST3410.verifySignature(hashmessage, sig[0], sig[1]))
    {
        return new SimpleTestResult(true, getName() + ": Okay");
    }
    else
    {
        return new SimpleTestResult(false, getName() + ": verification fails");
    }
}
项目:bc-java    文件:GOST3410Test.java   
public TestResult perform()
{
    BigInteger              r = new BigInteger("4deb95a0b35e7ed7edebe9bef5a0f93739e16b7ff27fe794d989d0c13159cfbc",16);
    BigInteger              s = new BigInteger("e1d0d30345c24cfeb33efde3deee5fbbda78ddc822b719d860cd0ba1fb6bd43b",16);
    GOST3410ParametersGenerator  pGen = new GOST3410ParametersGenerator();

    pGen.init(1024, 2, init_random);

    GOST3410Parameters           params = pGen.generateParameters();

    if (!pValue.equals(params.getP()) || !qValue.equals(params.getQ()))
    {
        return new SimpleTestResult(false, getName() + ": p or q wrong");
    }

    GOST3410KeyPairGenerator         GOST3410KeyGen = new GOST3410KeyPairGenerator();
    GOST3410KeyGenerationParameters  genParam = new GOST3410KeyGenerationParameters(keyRandom, params);

    GOST3410KeyGen.init(genParam);

    AsymmetricCipherKeyPair  pair = GOST3410KeyGen.generateKeyPair();

    ParametersWithRandom param = new ParametersWithRandom(pair.getPrivate(), random);

    GOST3410Signer GOST3410 = new GOST3410Signer();

    GOST3410.init(true, param);

    BigInteger[] sig = GOST3410.generateSignature(hashmessage);

    if (!r.equals(sig[0]))
    {
        return new SimpleTestResult(false, getName()
            + ": r component wrong." + System.getProperty("line.separator")
            + " expecting: " + r.toString(16) + System.getProperty("line.separator")
            + " got      : " + sig[0].toString(16));
    }

    if (!s.equals(sig[1]))
    {
        return new SimpleTestResult(false, getName()
            + ": s component wrong." + System.getProperty("line.separator")
            + " expecting: " + s.toString(16) + System.getProperty("line.separator")
            + " got      : " + sig[1].toString(16));
    }

    GOST3410.init(false, pair.getPublic());

    if (GOST3410.verifySignature(hashmessage, sig[0], sig[1]))
    {
        return new SimpleTestResult(true, getName() + ": Okay");
    }
    else
    {
        return new SimpleTestResult(false, getName() + ": verification fails");
    }
}
项目:bc-java    文件:GOST3410Test.java   
public TestResult perform()
{
    BigInteger              r = new BigInteger("712592d285b792e33b8a9a11e8e6c4f512ddf0042972bbfd1abb0a93e8fc6f54",16);
    BigInteger              s = new BigInteger("2cf26758321258b130d5612111339f09ceb8668241f3482e38baa56529963f07",16);
    GOST3410ParametersGenerator  pGen = new GOST3410ParametersGenerator();

    pGen.init(1024, 2, init_random);

    GOST3410Parameters           params = pGen.generateParameters();

    if (!pValue.equals(params.getP()) || !qValue.equals(params.getQ()))
    {
        return new SimpleTestResult(false, getName() + ": p or q wrong");
    }

    GOST3410KeyPairGenerator         GOST3410KeyGen = new GOST3410KeyPairGenerator();
    GOST3410KeyGenerationParameters  genParam = new GOST3410KeyGenerationParameters(keyRandom, params);

    GOST3410KeyGen.init(genParam);

    AsymmetricCipherKeyPair  pair = GOST3410KeyGen.generateKeyPair();

    ParametersWithRandom param = new ParametersWithRandom(pair.getPrivate(), random);

    GOST3410Signer GOST3410 = new GOST3410Signer();

    GOST3410.init(true, param);

    BigInteger[] sig = GOST3410.generateSignature(hashmessage);

    if (!r.equals(sig[0]))
    {
        return new SimpleTestResult(false, getName()
            + ": r component wrong." + System.getProperty("line.separator")
            + " expecting: " + r.toString(16) + System.getProperty("line.separator")
            + " got      : " + sig[0].toString(16));
    }

    if (!s.equals(sig[1]))
    {
        return new SimpleTestResult(false, getName()
            + ": s component wrong." + System.getProperty("line.separator")
            + " expecting: " + s.toString(16) + System.getProperty("line.separator")
            + " got      : " + sig[1].toString(16));
    }

    GOST3410.init(false, pair.getPublic());

    if (GOST3410.verifySignature(hashmessage, sig[0], sig[1]))
    {
        return new SimpleTestResult(true, getName() + ": Okay");
    }
    else
    {
        return new SimpleTestResult(false, getName() + ": verification fails");
    }
}
项目:bc-java    文件:GOST3410Test.java   
public TestResult perform()
{
    BigInteger              r = new BigInteger("90892707282f433398488f19d31ac48523a8e2ded68944e0da91c6895ee7045e",16);
    BigInteger              s = new BigInteger("3be4620ee88f1ee8f9dd63c7d145b7e554839feeca125049118262ea4651e9de",16);
    GOST3410ParametersGenerator  pGen = new GOST3410ParametersGenerator();

    pGen.init(1024, 2, init_random);

    GOST3410Parameters           params = pGen.generateParameters();

    if (!pValue.equals(params.getP()) || !qValue.equals(params.getQ()))
    {
        return new SimpleTestResult(false, getName() + ": p or q wrong");
    }

    GOST3410KeyPairGenerator         GOST3410KeyGen = new GOST3410KeyPairGenerator();
    GOST3410KeyGenerationParameters  genParam = new GOST3410KeyGenerationParameters(keyRandom, params);

    GOST3410KeyGen.init(genParam);

    AsymmetricCipherKeyPair  pair = GOST3410KeyGen.generateKeyPair();

    ParametersWithRandom param = new ParametersWithRandom(pair.getPrivate(), random);

    GOST3410Signer GOST3410 = new GOST3410Signer();

    GOST3410.init(true, param);

    BigInteger[] sig = GOST3410.generateSignature(hashmessage);

    if (!r.equals(sig[0]))
    {
        return new SimpleTestResult(false, getName()
            + ": r component wrong." + System.getProperty("line.separator")
            + " expecting: " + r.toString(16) + System.getProperty("line.separator")
            + " got      : " + sig[0].toString(16));
    }

    if (!s.equals(sig[1]))
    {
        return new SimpleTestResult(false, getName()
            + ": s component wrong." + System.getProperty("line.separator")
            + " expecting: " + s.toString(16) + System.getProperty("line.separator")
            + " got      : " + sig[1].toString(16));
    }

    GOST3410.init(false, pair.getPublic());

    if (GOST3410.verifySignature(hashmessage, sig[0], sig[1]))
    {
        return new SimpleTestResult(true, getName() + ": Okay");
    }
    else
    {
        return new SimpleTestResult(false, getName() + ": verification fails");
    }
}
项目:bc-java    文件:GOST3410Test.java   
public TestResult perform()
{
    BigInteger              r = new BigInteger("8f79a582513df84dc247bcb624340cc0e5a34c4324a20ce7fe3ab8ff38a9db71",16);
    BigInteger              s = new BigInteger("7508d22fd6cbb45efd438cb875e43f137247088d0f54b29a7c91f68a65b5fa85",16);
    GOST3410ParametersGenerator  pGen = new GOST3410ParametersGenerator();

    pGen.init(1024, 2, init_random);

    GOST3410Parameters           params = pGen.generateParameters();

    if (!pValue.equals(params.getP()) || !qValue.equals(params.getQ()))
    {
        return new SimpleTestResult(false, getName() + ": p or q wrong");
    }

    GOST3410KeyPairGenerator         GOST3410KeyGen = new GOST3410KeyPairGenerator();
    GOST3410KeyGenerationParameters  genParam = new GOST3410KeyGenerationParameters(keyRandom, params);

    GOST3410KeyGen.init(genParam);

    AsymmetricCipherKeyPair  pair = GOST3410KeyGen.generateKeyPair();

    ParametersWithRandom param = new ParametersWithRandom(pair.getPrivate(), random);

    GOST3410Signer GOST3410 = new GOST3410Signer();

    GOST3410.init(true, param);

    BigInteger[] sig = GOST3410.generateSignature(hashmessage);

    if (!r.equals(sig[0]))
    {
        return new SimpleTestResult(false, getName()
            + ": r component wrong." + System.getProperty("line.separator")
            + " expecting: " + r.toString(16) + System.getProperty("line.separator")
            + " got      : " + sig[0].toString(16));
    }

    if (!s.equals(sig[1]))
    {
        return new SimpleTestResult(false, getName()
            + ": s component wrong." + System.getProperty("line.separator")
            + " expecting: " + s.toString(16) + System.getProperty("line.separator")
            + " got      : " + sig[1].toString(16));
    }

    GOST3410.init(false, pair.getPublic());

    if (GOST3410.verifySignature(hashmessage, sig[0], sig[1]))
    {
        return new SimpleTestResult(true, getName() + ": Okay");
    }
    else
    {
        return new SimpleTestResult(false, getName() + ": verification fails");
    }
}
项目:bc-java    文件:GOST3410Test.java   
public TestResult perform()
{
    BigInteger              r = new BigInteger("169fdb2dc09f690b71332432bfec806042e258fa9a21dafe73c6abfbc71407d9",16);
    BigInteger              s = new BigInteger("9002551808ae40d19f6f31fb67e4563101243cf07cffd5f2f8ff4c537b0c9866",16);
    GOST3410ParametersGenerator  pGen = new GOST3410ParametersGenerator();

    pGen.init(1024, 2, init_random);

    GOST3410Parameters           params = pGen.generateParameters();

    if (!pValue.equals(params.getP()) || !qValue.equals(params.getQ()))
    {
        return new SimpleTestResult(false, getName() + ": p or q wrong");
    }

    GOST3410KeyPairGenerator         GOST3410KeyGen = new GOST3410KeyPairGenerator();
    GOST3410KeyGenerationParameters  genParam = new GOST3410KeyGenerationParameters(keyRandom, params);

    GOST3410KeyGen.init(genParam);

    AsymmetricCipherKeyPair  pair = GOST3410KeyGen.generateKeyPair();

    ParametersWithRandom param = new ParametersWithRandom(pair.getPrivate(), random);

    GOST3410Signer GOST3410 = new GOST3410Signer();

    GOST3410.init(true, param);

    BigInteger[] sig = GOST3410.generateSignature(hashmessage);

    if (!r.equals(sig[0]))
    {
        return new SimpleTestResult(false, getName()
            + ": r component wrong." + System.getProperty("line.separator")
            + " expecting: " + r.toString(16) + System.getProperty("line.separator")
            + " got      : " + sig[0].toString(16));
    }

    if (!s.equals(sig[1]))
    {
        return new SimpleTestResult(false, getName()
            + ": s component wrong." + System.getProperty("line.separator")
            + " expecting: " + s.toString(16) + System.getProperty("line.separator")
            + " got      : " + sig[1].toString(16));
    }

    GOST3410.init(false, pair.getPublic());

    if (GOST3410.verifySignature(hashmessage, sig[0], sig[1]))
    {
        return new SimpleTestResult(true, getName() + ": Okay");
    }
    else
    {
        return new SimpleTestResult(false, getName() + ": verification fails");
    }
}
项目:bc-java    文件:SignatureSpi.java   
public SignatureSpi()
{
    this.digest = new GOST3411Digest();
    this.signer = new GOST3410Signer();
}
项目:bc-java    文件:SignatureSpi.java   
public SignatureSpi()
{
    super("GOST3410");
    this.digest = new GOST3411Digest();
    this.signer = new GOST3410Signer();
}