本文整理汇总了Java中org.bouncycastle.crypto.macs.GOST28147Mac类的典型用法代码示例。如果您正苦于以下问题:Java GOST28147Mac类的具体用法?Java GOST28147Mac怎么用?Java GOST28147Mac使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GOST28147Mac类属于org.bouncycastle.crypto.macs包,在下文中一共展示了GOST28147Mac类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: Mac
import org.bouncycastle.crypto.macs.GOST28147Mac; //导入依赖的package包/类
public Mac()
{
super(new GOST28147Mac());
}
示例2: _createMACCalculator
import org.bouncycastle.crypto.macs.GOST28147Mac; //导入依赖的package包/类
@Override
public MACCalculator _createMACCalculator() {
return new MACCalculatorImpl(new GOST28147Mac(), 32, 0); // IV not supported - throws exception when passing ParameterWithIV
}
示例3: perform
import org.bouncycastle.crypto.macs.GOST28147Mac; //导入依赖的package包/类
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");
}