本文整理汇总了Java中org.bouncycastle.crypto.engines.SM4Engine类的典型用法代码示例。如果您正苦于以下问题:Java SM4Engine类的具体用法?Java SM4Engine怎么用?Java SM4Engine使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SM4Engine类属于org.bouncycastle.crypto.engines包,在下文中一共展示了SM4Engine类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initBlockCipherEngines
import org.bouncycastle.crypto.engines.SM4Engine; //导入依赖的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: test1000000
import org.bouncycastle.crypto.engines.SM4Engine; //导入依赖的package包/类
private void test1000000()
{
byte[] plain = Hex.decode("0123456789abcdeffedcba9876543210");
byte[] key = Hex.decode("0123456789abcdeffedcba9876543210");
byte[] cipher = Hex.decode("595298c7c6fd271f0402f804c33d3f66");
byte[] buf = new byte[16];
BlockCipher engine = new SM4Engine();
engine.init(true, new KeyParameter(key));
System.arraycopy(plain, 0, buf, 0, buf.length);
for (int i = 0; i != 1000000; i++)
{
engine.processBlock(buf, 0, buf, 0);
}
if (!areEqual(cipher, buf))
{
fail("1000000 encryption test failed");
}
engine.init(false, new KeyParameter(key));
for (int i = 0; i != 1000000; i++)
{
engine.processBlock(buf, 0, buf, 0);
}
if (!areEqual(plain, buf))
{
fail("1000000 decryption test failed");
}
}
示例3: ECB
import org.bouncycastle.crypto.engines.SM4Engine; //导入依赖的package包/类
public ECB()
{
super(new BlockCipherProvider()
{
public BlockCipher get()
{
return new SM4Engine();
}
});
}
示例4: SM4Test
import org.bouncycastle.crypto.engines.SM4Engine; //导入依赖的package包/类
SM4Test()
{
super(tests, new SM4Engine(), new KeyParameter(new byte[16]));
}
示例5: CMAC
import org.bouncycastle.crypto.engines.SM4Engine; //导入依赖的package包/类
public CMAC()
{
super(new CMac(new SM4Engine()));
}
示例6: GMAC
import org.bouncycastle.crypto.engines.SM4Engine; //导入依赖的package包/类
public GMAC()
{
super(new GMac(new GCMBlockCipher(new SM4Engine())));
}
示例7: Poly1305
import org.bouncycastle.crypto.engines.SM4Engine; //导入依赖的package包/类
public Poly1305()
{
super(new org.bouncycastle.crypto.macs.Poly1305(new SM4Engine()));
}