本文整理匯總了C#中System.Security.Cryptography.Rfc2898DeriveBytes.Skip方法的典型用法代碼示例。如果您正苦於以下問題:C# Rfc2898DeriveBytes.Skip方法的具體用法?C# Rfc2898DeriveBytes.Skip怎麽用?C# Rfc2898DeriveBytes.Skip使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Security.Cryptography.Rfc2898DeriveBytes
的用法示例。
在下文中一共展示了Rfc2898DeriveBytes.Skip方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: GetKeyInfo
public KeyInfo GetKeyInfo(string KeyName, byte[] IV, SymmetricAlgorithm Crypter)
{
if(null == this.KeyCache )
lock(_sharedKeyCacheLock)
{
if(null == this.KeyCache)
this.KeyCache = new ConcurrentDictionary<string, KeyInfo>();
}
if (KeyCache.ContainsKey(KeyName))
return KeyCache[KeyName];
string keyValue = null;
KeyInfo retVal = new KeyInfo();
if (null != this.SharedKeyServer)
keyValue = this.SharedKeyServer.GetKey(KeyName);
if (null == keyValue && null != this.KeyServer)
keyValue = this.KeyServer.GetKey(KeyName);
if(null != keyValue)
{
retVal.KeyValue = keyValue;
int keySize = Crypter.KeySize;
byte[] workingBytes = new Rfc2898DeriveBytes(keyValue, IV).GetBytes(keySize / 4);
retVal.KeyBytes = workingBytes.Take(keySize / 8).ToArray();
retVal.SecretBytes = workingBytes.Skip(keySize / 8).Take(keySize / 8).ToArray();
//if(!KeyCache.ContainsKey(KeyName))
// lock(_sharedKeyCacheLock)
// {
// if (!KeyCache.ContainsKey(KeyName))
// KeyCache.Add(KeyName, retVal);
// }
}
return retVal;
}