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


C# IMac类代码示例

本文整理汇总了C#中IMac的典型用法代码示例。如果您正苦于以下问题:C# IMac类的具体用法?C# IMac怎么用?C# IMac使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IMac类属于命名空间,在下文中一共展示了IMac类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: 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

示例2: IesEngine

 /**
 * set up for use with stream mode, where the key derivation function
 * is used to provide a stream of bytes to xor with 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
 */
 public IesEngine(IBasicAgreement agree, IDerivationFunction kdf, IMac mac)
 {
     _agree = agree;
     _kdf = kdf;
     _mac = mac;
     _macBuf = new byte[mac.GetMacSize()];
     //            this.cipher = null;
 }
开发者ID:sanyaade-iot,项目名称:Schmoose-BouncyCastle,代码行数:16,代码来源:IesEngine.cs

示例3: MacStream

        public MacStream(
			Stream	stream,
			IMac	readMac,
			IMac	writeMac)
        {
            this.stream = stream;
            this.inMac = readMac;
            this.outMac = writeMac;
        }
开发者ID:Noyabronok,项目名称:itextsharpml,代码行数:9,代码来源:MacStream.cs

示例4: NetworkLayer

        public NetworkLayer(IMac mac)
        {
            _mac = mac;
            _mgmt = new NetworkMgmt(this);
            _route = new Routing(this, mac, this);

#if USE_FRAG
            int mtu, head, tail;
            _route.GetMtuSize(out mtu, out head, out tail);
            _frag = new Fragmentation.Fragmentation(10, _route.DataRequest, mtu, head, tail);
#endif

            _mac.BeaconNotifyIndication = MacBeaconNotifyIndication;
            _mac.ResetRequest(true, null);
        }
开发者ID:aura1213,项目名称:netmf-interpreter,代码行数:15,代码来源:NetworkLayer.cs

示例5: 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

示例6: testSingleByte

		private void testSingleByte(IMac mac, TestCase testCase)
		{
			byte[] ad = testCase.getAd();
			for (int i = 0; i < ad.Length; i++)
			{
				mac.Update(ad[i]);
			}
			checkMac(mac, testCase);
		}
开发者ID:jesusgarza,项目名称:bc-csharp,代码行数:9,代码来源:GMacTest.cs

示例7: 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

示例8: testMultibyte

		private void testMultibyte(IMac mac, TestCase testCase)
		{
			mac.BlockUpdate(testCase.getAd(), 0, testCase.getAd().Length);
			checkMac(mac, testCase);
		}
开发者ID:jesusgarza,项目名称:bc-csharp,代码行数:5,代码来源:GMacTest.cs

示例9: HMacDrbgProvider

 public HMacDrbgProvider(IMac hMac, byte[] nonce, byte[] personalizationString, int securityStrength)
 {
     this.mHMac = hMac;
     this.mNonce = nonce;
     this.mPersonalizationString = personalizationString;
     this.mSecurityStrength = securityStrength;
 }
开发者ID:KimikoMuffin,项目名称:bc-csharp,代码行数:7,代码来源:SP800SecureRandomBuilder.cs

示例10: Routing

        private AutoResetEvent _getAddressEvent; // event raised when we got an address

        public Routing(INetworkLayer net, IMac mac, IDataCallbacks data)
        {
            _net = net;
            _mac = mac;
            _data = data;

            _mac.GetMtuSize(out _macMtu, out _macHeader, out _macTailer);

            // calculate the header sizes for 6LoWPAN
            // private encapsulation requires one byte (Message.Data.cLength) additional header space
            int myHeader = Messages6LoWPAN.MeshHeader.cLengthMax + Messages6LoWPAN.BroadcastHeader.cLength;
            _netHeader6Low = _macHeader + myHeader;
            _netMtu6Low = _macMtu - myHeader;
            _netTailer6Low = _macTailer;

            _neighbourTable = new NeighborTable(this, _macHeader, _macTailer);
            _routingTable = new RoutingTable(this);
            _messageContext = new MessageContext();

            _seqNoDYMO = 0;
            _seqNoBroadcast = 0;
            _panId = 0;
            _addrShort = cInvalidShortAddr;
            _addrExt = 0; // to be set at start
            _isRunning = false;
            _getAddressEvent = new AutoResetEvent(false);
        }
开发者ID:koson,项目名称:.NETMF_for_LPC17xx,代码行数:29,代码来源:Routing.cs

示例11: UpdateMac

 private static void UpdateMac(IMac mac, byte[] bytes)
 {
     mac.BlockUpdate(bytes, 0, bytes.Length);
     Arrays.Fill(bytes, (byte)0);
 }
开发者ID:KimikoMuffin,项目名称:bc-csharp,代码行数:5,代码来源:JPakeUtilities.cs

示例12: MacOutputStream

		internal MacOutputStream(IMac mac)
		{
			this.mac = mac;
		}
开发者ID:htlp,项目名称:itextsharp,代码行数:4,代码来源:MacOutputStream.cs

示例13: DoFinal

 public static byte[] DoFinal(IMac mac, byte[] input)
 {
     mac.BlockUpdate(input, 0, input.Length);
     return DoFinal(mac);
 }
开发者ID:woutersmit,项目名称:NBitcoin,代码行数:5,代码来源:MacUtilities.cs

示例14: 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

示例15: TlsMac

        /**
         * Generate a new instance of an TlsMac.
         *
         * @param context the TLS client context
         * @param digest  The digest to use.
         * @param key     A byte-array where the key for this MAC is located.
         * @param keyOff  The number of bytes to skip, before the key starts in the buffer.
         * @param keyLen  The length of the key.
         */
        public TlsMac(TlsContext context, IDigest digest, byte[] key, int keyOff, int keyLen)
        {
            this.context = context;

            KeyParameter keyParameter = new KeyParameter(key, keyOff, keyLen);

            this.secret = Arrays.Clone(keyParameter.GetKey());

            // TODO This should check the actual algorithm, not rely on the engine type
            if (digest is LongDigest)
            {
                this.digestBlockSize = 128;
                this.digestOverhead = 16;
            }
            else
            {
                this.digestBlockSize = 64;
                this.digestOverhead = 8;
            }

            if (TlsUtilities.IsSsl(context))
            {
                this.mac = new Ssl3Mac(digest);

                // TODO This should check the actual algorithm, not assume based on the digest size
                if (digest.GetDigestSize() == 20)
                {
                    /*
                     * NOTE: When SHA-1 is used with the SSL 3.0 MAC, the secret + input pad is not
                     * digest block-aligned.
                     */
                    this.digestOverhead = 4;
                }
            }
            else
            {
                this.mac = new HMac(digest);

                // NOTE: The input pad for HMAC is always a full digest block
            }

            this.mac.Init(keyParameter);

            this.macLength = mac.GetMacSize();
            if (context.SecurityParameters.truncatedHMac)
            {
                this.macLength = System.Math.Min(this.macLength, 10);
            }
        }
开发者ID:ubberkid,项目名称:PeerATT,代码行数:58,代码来源:TlsMac.cs


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