private static void SaveEncryptedFile(Options options, AesEncryptionOutput output) { // Save encrypted file File.WriteAllBytes(options.Output, output.Data); // Save encryption key file if (!string.IsNullOrEmpty(options.SaveKey)) { var lines = new string[2]; lines[0] = Convert.ToBase64String(output.Key); lines[1] = Convert.ToBase64String(output.InitializationVector); File.WriteAllLines(options.SaveKey, lines); } }
public static void EncryptWithoutKey(Options options, byte[] data) { AesEncryptionOutput output = AesCryptor.Encrypt(data); SaveEncryptedFile(options, output); }