本文整理匯總了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()));
}