本文整理汇总了C#中IMac类的典型用法代码示例。如果您正苦于以下问题:C# IMac类的具体用法?C# IMac怎么用?C# IMac使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IMac类属于命名空间,在下文中一共展示了IMac类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: StreamMac
/// <summary>
/// Initialize the class with a digest enumeration
/// </summary>
///
/// <param name="Mac">The initialized <see cref="IMac"/> instance</param>
/// <param name="DisposeEngine">Dispose of digest engine when <see cref="Dispose()"/> on this class is called; default is false</param>
///
/// <exception cref="CryptoProcessingException">Thrown if an uninitialized Mac is used</exception>
public StreamMac(IMac Mac, bool DisposeEngine = false)
{
if (Mac == null)
throw new CryptoProcessingException("StreamMac:CTor", "The Mac can not be null!", new ArgumentNullException());
if (!Mac.IsInitialized)
throw new CryptoProcessingException("StreamMac:CTor", "The Mac has not been initialized!", new ArgumentException());
_macEngine = Mac;
_blockSize = _macEngine.BlockSize;
_disposeEngine = DisposeEngine;
}
开发者ID:modulexcite,项目名称:CEX,代码行数:19,代码来源:StreamMac.cs
示例15: UpdateRecordMac
protected virtual void UpdateRecordMac(IMac mac, byte[] buf, int off, int len)
{
mac.BlockUpdate(buf, off, len);
byte[] longLen = Pack.UInt64_To_LE((ulong)len);
mac.BlockUpdate(longLen, 0, longLen.Length);
}
开发者ID:ALange,项目名称:OutlookPrivacyPlugin,代码行数:7,代码来源:Chacha20Poly1305.cs
示例16: UpdateRecordMacLength
protected virtual void UpdateRecordMacLength(IMac mac, int len)
{
byte[] longLen = Pack.UInt64_To_LE((ulong)len);
mac.BlockUpdate(longLen, 0, longLen.Length);
}
开发者ID:gkardava,项目名称:WinPass,代码行数:5,代码来源:Chacha20Poly1305.cs
示例17: BuildHMac
/**
* Build a SecureRandom based on a SP 800-90A HMAC DRBG.
*
* @param hMac HMAC algorithm to use in the DRBG underneath the SecureRandom.
* @param nonce nonce value to use in DRBG construction.
* @param predictionResistant specify whether the underlying DRBG in the resulting SecureRandom should reseed on each request for bytes.
* @return a SecureRandom supported by a HMAC DRBG.
*/
public SP800SecureRandom BuildHMac(IMac hMac, byte[] nonce, bool predictionResistant)
{
return new SP800SecureRandom(mRandom, mEntropySourceProvider.Get(mEntropyBitsRequired),
new HMacDrbgProvider(hMac, nonce, mPersonalizationString, mSecurityStrength), predictionResistant);
}
开发者ID:KimikoMuffin,项目名称:bc-csharp,代码行数:13,代码来源:SP800SecureRandomBuilder.cs
示例18: UpdateRecordMacText
protected virtual void UpdateRecordMacText(IMac mac, byte[] buf, int off, int len)
{
mac.BlockUpdate(buf, off, len);
int partial = len % 16;
if (partial != 0)
{
mac.BlockUpdate(Zeroes, 0, 16 - partial);
}
}
开发者ID:gkardava,项目名称:WinPass,代码行数:10,代码来源:Chacha20Poly1305.cs
示例19: CmsAuthenticatedDataOutputStream
public CmsAuthenticatedDataOutputStream(
Stream macStream,
IMac mac,
BerSequenceGenerator cGen,
BerSequenceGenerator authGen,
BerSequenceGenerator eiGen)
{
this.macStream = macStream;
this.mac = mac;
this.cGen = cGen;
this.authGen = authGen;
this.eiGen = eiGen;
}
开发者ID:ktw,项目名称:OutlookPrivacyPlugin,代码行数:13,代码来源:CMSAuthenticatedDataStreamGenerator.cs
示例20: GetMaxSecurityStrength
internal static int GetMaxSecurityStrength(IMac m)
{
string name = m.AlgorithmName;
return (int)maxSecurityStrengths[name.Substring(0, name.IndexOf("/"))];
}
开发者ID:KimikoMuffin,项目名称:bc-csharp,代码行数:6,代码来源:DrbgUtilities.cs
注:本文中的IMac类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论