本文整理汇总了Java中org.bouncycastle.crypto.macs.CMac.getMacSize方法的典型用法代码示例。如果您正苦于以下问题:Java CMac.getMacSize方法的具体用法?Java CMac.getMacSize怎么用?Java CMac.getMacSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bouncycastle.crypto.macs.CMac
的用法示例。
在下文中一共展示了CMac.getMacSize方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: EAXBlockCipher
import org.bouncycastle.crypto.macs.CMac; //导入方法依赖的package包/类
/**
* Constructor that accepts an instance of a block cipher engine.
*
* @param cipher the engine to use
*/
public EAXBlockCipher(BlockCipher cipher)
{
blockSize = cipher.getBlockSize();
mac = new CMac(cipher);
macBlock = new byte[blockSize];
bufBlock = new byte[blockSize * 2];
associatedTextMac = new byte[mac.getMacSize()];
nonceMac = new byte[mac.getMacSize()];
this.cipher = new SICBlockCipher(cipher);
}
示例2: EAXBlockCipher
import org.bouncycastle.crypto.macs.CMac; //导入方法依赖的package包/类
/**
* Constructor that accepts an instance of a block cipher engine.
*
* @param cipher the engine to use
*/
public EAXBlockCipher(BlockCipher cipher)
{
blockSize = cipher.getBlockSize();
mac = new CMac(cipher);
macBlock = new byte[blockSize];
associatedTextMac = new byte[mac.getMacSize()];
nonceMac = new byte[mac.getMacSize()];
this.cipher = new SICBlockCipher(cipher);
}
示例3: scp03_mac
import org.bouncycastle.crypto.macs.CMac; //导入方法依赖的package包/类
public static byte[] scp03_mac(byte[] keybytes, byte[] msg, int lengthBits) {
// Use BouncyCastle light interface.
BlockCipher cipher = new AESEngine();
CMac cmac = new CMac(cipher);
cmac.init(new KeyParameter(keybytes));
cmac.update(msg, 0, msg.length);
byte[] out = new byte[cmac.getMacSize()];
cmac.doFinal(out, 0);
return Arrays.copyOf(out, lengthBits / 8);
}