Example #1
0
File: Cipher.cs Project: avs009/gsf
 // Coerce key and iv into legal format for specificed algorithm then encrypt
 private static byte[] LegalKeyEncrypt(SymmetricAlgorithm algorithm, byte[] data, int startIndex, int length, byte[] key, byte[] iv)
 {
     byte[] rgbKey = algorithm.GetLegalKey(key);
     byte[] rgbIV = algorithm.GetLegalIV(iv);
     return algorithm.Encrypt(data, startIndex, length, rgbKey, rgbIV);
 }