本文整理汇总了Java中org.bouncycastle.crypto.engines.GOST28147Engine类的典型用法代码示例。如果您正苦于以下问题:Java GOST28147Engine类的具体用法?Java GOST28147Engine怎么用?Java GOST28147Engine使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
GOST28147Engine类属于org.bouncycastle.crypto.engines包,在下文中一共展示了GOST28147Engine类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initBlockCipherEngines
import org.bouncycastle.crypto.engines.GOST28147Engine; //导入依赖的package包/类
private static void initBlockCipherEngines() {
blockCipherEngines.put("MARS", MarsEngine.class);
blockCipherEngines.put("AES", AESEngine.class);
blockCipherEngines.put("Blowfish", BlowfishEngine.class);
blockCipherEngines.put("Camellia", CamelliaEngine.class);
blockCipherEngines.put("CAST5", CAST5Engine.class);
blockCipherEngines.put("CAST6", CAST6Engine.class);
blockCipherEngines.put("DESede", DESedeEngine.class);
blockCipherEngines.put("DES", DESEngine.class);
blockCipherEngines.put("GOST28147", GOST28147Engine.class);
blockCipherEngines.put("IDEA", IDEAEngine.class);
blockCipherEngines.put("Noekeon", NoekeonEngine.class);
blockCipherEngines.put("RC2", RC2Engine.class);
blockCipherEngines.put("RC5", RC532Engine.class);
blockCipherEngines.put("RC6", RC6Engine.class);
blockCipherEngines.put("SEED", SEEDEngine.class);
blockCipherEngines.put("Serpent", SerpentEngine.class);
blockCipherEngines.put("Shacal2", Shacal2Engine.class);
blockCipherEngines.put("Skipjack", SkipjackEngine.class);
blockCipherEngines.put("SM4", SM4Engine.class);
blockCipherEngines.put("TEA", TEAEngine.class);
blockCipherEngines.put("Twofish", TwofishEngine.class);
blockCipherEngines.put("XTEA", XTEAEngine.class);
blockCipherEngines.put("Threefish", ThreefishEngine.class);
}
示例2: GOST3411Digest
import org.bouncycastle.crypto.engines.GOST28147Engine; //导入依赖的package包/类
/**
* Standard constructor
*/
public GOST3411Digest()
{
sBox = GOST28147Engine.getSBox("D-A");
cipher.init(true, new ParametersWithSBox(null, sBox));
reset();
}
示例3: main
import org.bouncycastle.crypto.engines.GOST28147Engine; //导入依赖的package包/类
public static void main(
String[] args)
{
HMac gMac = new HMac(new GOST3411Digest(GOST28147Engine.getSBox("D-Test")));
gMac.init(new KeyParameter(PKCS5S1ParametersGenerator.PKCS5PasswordToUTF8Bytes("Boss".toCharArray())));
byte[] iBuf = new byte[4];
byte[] data = Hex.decode("b5d78fa546ba645c");
gMac.update(data, 0, data.length);
byte[] mac = new byte[gMac.getMacSize()];
int pos = 3;
while (++iBuf[pos] == 0)
{
--pos;
}
gMac.update(iBuf, 0, iBuf.length);
gMac.doFinal(mac, 0);
System.err.println(mac.length + " " + new String(Hex.encode(mac)));
PKCS5S2ParametersGenerator pGen = new PKCS5S2ParametersGenerator(new GOST3411Digest());
pGen.init(PKCS5S1ParametersGenerator.PKCS5PasswordToUTF8Bytes("1".toCharArray()), data, 2048);
KeyParameter kp = (KeyParameter)pGen.generateDerivedMacParameters(256);
System.err.println(kp.getKey().length + " " + new String(Hex.encode(kp.getKey())));
runTest(new GOST3411DigestTest());
}
示例4: GOST28147ParameterSpec
import org.bouncycastle.crypto.engines.GOST28147Engine; //导入依赖的package包/类
public GOST28147ParameterSpec(
String sBoxName)
{
this.sBox = GOST28147Engine.getSBox(sBoxName);
}
示例5: ECB
import org.bouncycastle.crypto.engines.GOST28147Engine; //导入依赖的package包/类
public ECB()
{
super(new GOST28147Engine());
}
示例6: CBC
import org.bouncycastle.crypto.engines.GOST28147Engine; //导入依赖的package包/类
public CBC()
{
super(new CBCBlockCipher(new GOST28147Engine()), 64);
}
示例7: GOST28147Test
import org.bouncycastle.crypto.engines.GOST28147Engine; //导入依赖的package包/类
GOST28147Test()
{
super(tests, new GOST28147Engine(), new KeyParameter(new byte[32]));
}
示例8: GOST28147ParameterSpec
import org.bouncycastle.crypto.engines.GOST28147Engine; //导入依赖的package包/类
public GOST28147ParameterSpec(
String sBoxName)
{
this.sBox = GOST28147Engine.getSBox(sBoxName);
}
示例9: GCFB
import org.bouncycastle.crypto.engines.GOST28147Engine; //导入依赖的package包/类
public GCFB()
{
super(new BufferedBlockCipher(new GCFBBlockCipher(new GOST28147Engine())), 64);
}
示例10: perform
import org.bouncycastle.crypto.engines.GOST28147Engine; //导入依赖的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");
}