本文整理汇总了C#中IMac.GetMacSize方法的典型用法代码示例。如果您正苦于以下问题:C# IMac.GetMacSize方法的具体用法?C# IMac.GetMacSize怎么用?C# IMac.GetMacSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IMac
的用法示例。
在下文中一共展示了IMac.GetMacSize方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EaxBlockCipher
/**
* Constructor that accepts an instance of a block cipher engine.
*
* @param cipher the engine to use
*/
public EaxBlockCipher(
IBlockCipher 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);
}
示例2: DoFinal
public static byte[] DoFinal(
IMac mac)
{
byte[] b = new byte[mac.GetMacSize()];
mac.DoFinal(b, 0);
return b;
}
示例3: IesEngine
/**
* set up for use in conjunction with a block cipher to handle the
* message.
*
* @param agree the key agreement used as the basis for the encryption
* @param kdf the key derivation function used for byte generation
* @param mac the message authentication code generator for the message
* @param cipher the cipher to used for encrypting the message
*/
public IesEngine(IBasicAgreement agree, IDerivationFunction kdf, IMac mac, BufferedBlockCipher cipher)
{
_agree = agree;
_kdf = kdf;
_mac = mac;
_macBuf = new byte[mac.GetMacSize()];
_cipher = cipher;
}
示例4: HMacSP800Drbg
/**
* Construct a SP800-90A Hash DRBG.
* <p>
* Minimum entropy requirement is the security strength requested.
* </p>
* @param hMac Hash MAC to base the DRBG on.
* @param securityStrength security strength required (in bits)
* @param entropySource source of entropy to use for seeding/reseeding.
* @param personalizationString personalization string to distinguish this DRBG (may be null).
* @param nonce nonce to further distinguish this DRBG (may be null).
*/
public HMacSP800Drbg(IMac hMac, int securityStrength, IEntropySource entropySource, byte[] personalizationString, byte[] nonce)
{
if (securityStrength > DrbgUtilities.GetMaxSecurityStrength(hMac))
throw new ArgumentException("Requested security strength is not supported by the derivation function");
if (entropySource.EntropySize < securityStrength)
throw new ArgumentException("Not enough entropy for security strength required");
mHMac = hMac;
mSecurityStrength = securityStrength;
mEntropySource = entropySource;
byte[] entropy = GetEntropy();
byte[] seedMaterial = Arrays.ConcatenateAll(entropy, nonce, personalizationString);
mK = new byte[hMac.GetMacSize()];
mV = new byte[mK.Length];
Arrays.Fill(mV, (byte)1);
hmac_DRBG_Update(seedMaterial);
mReseedCounter = 1;
}
示例5: Pkcs5S2ParametersGenerator
public Pkcs5S2ParametersGenerator(IDigest digest)
{
this.hMac = new HMac(digest);
this.state = new byte[hMac.GetMacSize()];
}
示例6: checkMac
private void checkMac(IMac mac, TestCase testCase)
{
byte[] generatedMac = new byte[mac.GetMacSize()];
mac.DoFinal(generatedMac, 0);
if (!AreEqual(testCase.getTag(), generatedMac))
{
Fail("Failed " + testCase.getName() + " - expected " + Hex.ToHexString(testCase.getTag()) + " got "
+ Hex.ToHexString(generatedMac));
}
}
示例7: DeterministicECDSA
/**
* Create an instance, using the specified hash function.
* The name is used to obtain from the JVM an implementation
* of the hash function and an implementation of HMAC.
*
* @param hashName the hash function name
* @throws IllegalArgumentException on unsupported name
*/
public DeterministicECDSA(String hashName)
{
try
{
dig = DigestUtilities.GetDigest(hashName);
}
catch(SecurityUtilityException nsae)
{
throw new ArgumentException("Invalid hash", "hashName", nsae);
}
if(hashName.IndexOf('-') < 0)
{
macName = "Hmac" + hashName;
}
else
{
StringBuilder sb = new StringBuilder();
sb.Append("Hmac");
int n = hashName.Length;
for(int i = 0 ; i < n ; i++)
{
char c = hashName[i];
if(c != '-')
{
sb.Append(c);
}
}
macName = sb.ToString();
}
try
{
hmac = MacUtilities.GetMac(macName);
}
catch(SecurityUtilityException nsae)
{
throw new InvalidOperationException(nsae.Message, nsae);
}
holen = hmac.GetMacSize();
}