Raven.Bundles.Encryption.Codec.GetStartingKeyAndIVForEncryption C# (CSharp) Method

GetStartingKeyAndIVForEncryption() private method

private GetStartingKeyAndIVForEncryption ( SymmetricAlgorithm algorithm ) : byte[]>.Tuple
algorithm System.Security.Cryptography.SymmetricAlgorithm
return byte[]>.Tuple
		private Tuple<byte[], byte[]> GetStartingKeyAndIVForEncryption(SymmetricAlgorithm algorithm)
		{
			int bits = algorithm.ValidKeySize(Constants.DefaultKeySizeToUseInActualEncryptionInBits) ? 
				Constants.DefaultKeySizeToUseInActualEncryptionInBits : 
				algorithm.LegalKeySizes[0].MaxSize;

			encryptionKeySize = bits / 8;
			encryptionIVSize = algorithm.IV.Length;

			var deriveBytes = new Rfc2898DeriveBytes(EncryptionSettings.EncryptionKey, GetSaltFromEncryptionKey(EncryptionSettings.EncryptionKey), Constants.Rfc2898Iterations);
			return Tuple.Create(deriveBytes.GetBytes(encryptionKeySize.Value), deriveBytes.GetBytes(encryptionIVSize.Value));
		}