System.Security.Cryptography.DESTransform.GetStrongKey C# (CSharp) Метод

GetStrongKey() статический приватный Метод

static private GetStrongKey ( ) : byte[]
Результат byte[]
		static internal byte[] GetStrongKey ()
		{
			byte[] key = KeyBuilder.Key (DESTransform.KEY_BYTE_SIZE);
			while (DES.IsWeakKey (key) || DES.IsSemiWeakKey (key))
				key = KeyBuilder.Key (DESTransform.KEY_BYTE_SIZE);
			return key;
		}
	} 

Usage Example

Пример #1
0
 internal DESTransform(SymmetricAlgorithm symmAlgo, bool encryption, byte[] key, byte[] iv) : base(symmAlgo, encryption, iv)
 {
     byte[] array = null;
     if (key == null)
     {
         key   = DESTransform.GetStrongKey();
         array = key;
     }
     if (DES.IsWeakKey(key) || DES.IsSemiWeakKey(key))
     {
         string text = Locale.GetText("This is a known weak, or semi-weak, key.");
         throw new CryptographicException(text);
     }
     if (array == null)
     {
         array = (byte[])key.Clone();
     }
     this.keySchedule = new byte[DESTransform.KEY_BYTE_SIZE * 16];
     this.byteBuff    = new byte[DESTransform.BLOCK_BYTE_SIZE];
     this.dwordBuff   = new uint[DESTransform.BLOCK_BYTE_SIZE / 4];
     this.SetKey(array);
 }
All Usage Examples Of System.Security.Cryptography.DESTransform::GetStrongKey