Java 类org.bouncycastle.crypto.macs.GOST28147Mac 实例源码

项目:ipack    文件:GOST28147.java   
public Mac()
{
    super(new GOST28147Mac());
}
项目:Aki-SSL    文件:GOST28147.java   
public Mac()
{
    super(new GOST28147Mac());
}
项目:subshare    文件:MACCalculatorFactoryImpl.java   
@Override
public MACCalculator _createMACCalculator() {
    return new MACCalculatorImpl(new GOST28147Mac(), 32, 0); // IV not supported - throws exception when passing ParameterWithIV
}
项目:CryptMeme    文件:GOST28147.java   
public Mac()
{
    super(new GOST28147Mac());
}
项目:irma_future_id    文件:GOST28147.java   
public Mac()
{
    super(new GOST28147Mac());
}
项目:bc-java    文件:GOST28147.java   
public Mac()
{
    super(new GOST28147Mac());
}
项目:gwt-crypto    文件:GOST28147MacTest.java   
public TestResult perform()
{
    // test1
    Mac          mac = new GOST28147Mac();
    KeyParameter key = new KeyParameter(gkeyBytes1);

    mac.init(key);

    mac.update(input3, 0, input3.length);

    byte[] out = new byte[4];

    mac.doFinal(out, 0);

    if (!Arrays.areEqual(out, output7))
    {
        return new SimpleTestResult(false, getName() + ": Failed test 1 - expected " + new String(Hex.encode(output7)) + " got " + new String(Hex.encode(out)));
    }

    // test2
    key = new KeyParameter(gkeyBytes2);

    ParametersWithSBox gparam = new ParametersWithSBox(key, GOST28147Engine.getSBox("E-A"));

    mac.init(gparam);

    mac.update(input4, 0, input4.length);

    out = new byte[4];

    mac.doFinal(out, 0);

    if (!Arrays.areEqual(out, output8))
    {
        return new SimpleTestResult(false, getName() + ": Failed test 2 - expected " + new String(Hex.encode(output8)) + " got " + new String(Hex.encode(out)));
    }

    return new SimpleTestResult(true, getName() + ": Okay");
}
项目:irma_future_id    文件:GOST28147MacTest.java   
public TestResult perform()
{
    // test1
    Mac          mac = new GOST28147Mac();
    KeyParameter key = new KeyParameter(gkeyBytes1);

    mac.init(key);

    mac.update(input3, 0, input3.length);

    byte[] out = new byte[4];

    mac.doFinal(out, 0);

    if (!Arrays.areEqual(out, output7))
    {
        return new SimpleTestResult(false, getName() + ": Failed test 1 - expected " + new String(Hex.encode(output7)) + " got " + new String(Hex.encode(out)));
    }

    // test2
    key = new KeyParameter(gkeyBytes2);

    ParametersWithSBox gparam = new ParametersWithSBox(key, GOST28147Engine.getSBox("E-A"));

    mac.init(gparam);

    mac.update(input4, 0, input4.length);

    out = new byte[4];

    mac.doFinal(out, 0);

    if (!Arrays.areEqual(out, output8))
    {
        return new SimpleTestResult(false, getName() + ": Failed test 2 - expected " + new String(Hex.encode(output8)) + " got " + new String(Hex.encode(out)));
    }

    return new SimpleTestResult(true, getName() + ": Okay");
}
项目:bc-java    文件:GOST28147MacTest.java   
public TestResult perform()
{
    // test1
    Mac          mac = new GOST28147Mac();
    KeyParameter key = new KeyParameter(gkeyBytes1);

    mac.init(key);

    mac.update(input3, 0, input3.length);

    byte[] out = new byte[4];

    mac.doFinal(out, 0);

    if (!Arrays.areEqual(out, output7))
    {
        return new SimpleTestResult(false, getName() + ": Failed test 1 - expected " + new String(Hex.encode(output7)) + " got " + new String(Hex.encode(out)));
    }

    // test2
    key = new KeyParameter(gkeyBytes2);

    ParametersWithSBox gparam = new ParametersWithSBox(key, GOST28147Engine.getSBox("E-A"));

    mac.init(gparam);

    mac.update(input4, 0, input4.length);

    out = new byte[4];

    mac.doFinal(out, 0);

    if (!Arrays.areEqual(out, output8))
    {
        return new SimpleTestResult(false, getName() + ": Failed test 2 - expected " + new String(Hex.encode(output8)) + " got " + new String(Hex.encode(out)));
    }

    return new SimpleTestResult(true, getName() + ": Okay");
}