当前位置: 首页>>代码示例>>C#>>正文


C# IMac.GetMacSize方法代码示例

本文整理汇总了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);
		}
开发者ID:ALange,项目名称:OutlookPrivacyPlugin,代码行数:15,代码来源:EAXBlockCipher.cs

示例2: DoFinal

        public static byte[] DoFinal(
			IMac mac)
        {
            byte[] b = new byte[mac.GetMacSize()];
            mac.DoFinal(b, 0);
            return b;
        }
开发者ID:sanyaade-iot,项目名称:Schmoose-BouncyCastle,代码行数:7,代码来源:MacUtilities.cs

示例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;
 }
开发者ID:sanyaade-iot,项目名称:Schmoose-BouncyCastle,代码行数:17,代码来源:IesEngine.cs

示例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;
	    }
开发者ID:KimikoMuffin,项目名称:bc-csharp,代码行数:33,代码来源:HMacSP800Drbg.cs

示例5: Pkcs5S2ParametersGenerator

 public Pkcs5S2ParametersGenerator(IDigest digest)
 {
     this.hMac = new HMac(digest);
     this.state = new byte[hMac.GetMacSize()];
 }
开发者ID:gkardava,项目名称:WinPass,代码行数:5,代码来源:Pkcs5S2ParametersGenerator.cs

示例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));
			}
		}
开发者ID:jesusgarza,项目名称:bc-csharp,代码行数:10,代码来源:GMacTest.cs

示例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();
        }
开发者ID:nikropht,项目名称:NBitcoin,代码行数:48,代码来源:DeterministicECDSA.cs


注:本文中的IMac.GetMacSize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。