本文整理汇总了C#中Cache.VerifyDigitalSignature方法的典型用法代码示例。如果您正苦于以下问题:C# Cache.VerifyDigitalSignature方法的具体用法?C# Cache.VerifyDigitalSignature怎么用?C# Cache.VerifyDigitalSignature使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cache
的用法示例。
在下文中一共展示了Cache.VerifyDigitalSignature方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Communication
public void Communication()
{
lock (_downloadNodeHash)
{
_downloadNodeHash.Add(key.FileLocation.NodeID);
}
NodeListViewItem nlvi = null;
string stringHash = "";
int i = -1;
IFileShareService proxy = null;
try
{
stringHash = BinaryEditor.BytesToHexString(item.Hash);
Cache cache;
lock (Settings.Default._cacheController.CacheList)
{
cache = Settings.Default._cacheController.CacheList.
FirstOrDefault(n => BinaryEditor.ArrayEquals(n.SignatureHash, item.SignatureHash));
}
lock (_downloadBlockDic)
{
if (!_downloadBlockDic.ContainsKey(stringHash))
_downloadBlockDic.Add(stringHash, new List<int>());
}
nlvi = new NodeListViewItem()
{
CommunicationType = "download",
Description = "キャッシュブロックを受信しています",
Node = key.FileLocation,
};
NodeShowAdd(this, nlvi);
using (ChannelFactory<IFileShareService> channel = new ChannelFactory<IFileShareService>("Tcp_Client", key.FileLocation.Endpoint))
{
proxy = channel.CreateChannel();
if (cache == null)
{
cache = new Cache();
cache.Key = Clone.DeepCopyClone<Key>(key);
cache.Key.FileLocation = new Node();
cache.Key.Review = null;
cache.Category = key.Cache_Category;
cache.CreationTime = key.Cache_CreationTime;
cache.Name = key.Cache_FileName;
cache.Sign = key.Cache_Sign;
cache.Size = key.Cache_Size;
cache.Signature = key.Cache_Signature;
cache.Signature_SHA1 = key.Cache_Signature_SHA1;
cache.PublicKey = key.PublicKey;
cache.CacheBlockHash = proxy.GetCacheBlockHashList(key.Cache_Hash);
if (!cache.VerifyDigitalSignature()) throw new ApplicationException("電子署名が不正です");
lock (Settings.Default._cacheController.CacheList)
{
Settings.Default._cacheController.CacheList.Add(cache);
}
}
for (; ; )
{
lock (_downloadBlockDic)
{
List<int> bmp = new List<int>();
for (int j = 0; j < item.CacheBlockLength; j++)
{
if ((!Settings.Default._cacheController.ContainsKey(stringHash) ||
Settings.Default._cacheController[stringHash][j] == null) && key.CacheBlockBitmap[j] == true &&
!_downloadBlockDic[stringHash].Any(n => n == j))
{
bmp.Add(j);
}
}
if (bmp.Count == 0) return;
i = bmp[new Random().Next(bmp.Count)];
_downloadBlockDic[stringHash].Add(i);
}
byte[] block = proxy.GetCacheBlock(item.Hash, i);
DebugWrite(this, "download成功:キャッシュブロックのダウンロードに成功しました");
if (block != null)
Settings.Default._cacheController[cache, i] = block;
lock (_downloadBlockDic)
{
_downloadBlockDic[stringHash].Remove(i);
}
}
}
//.........这里部分代码省略.........