Encryption algorithms do not care about particular content of the data
to be encrypted or decrypted. They all work with arrays of bytes,
nothing else, so any file can be processed in the same way. The problem is: by encryption, you might mean few very different things.
So the steps are:- 1.Convert an audio/video file in array of bytes. 2.Use a cryptographic algorithm to encrypt/decrypt.
How to convert a media file in array of bytes:- How do I read a file as an array of bytes? .NET provides a lot of great tools for reading and writing files, lots of stream classes. If you're like me, I kind of find dealing with streams a pain. If I want to read a file I should only have to say "ReadFile" and the content should be there the way I want. As a result, I tend to write lots of helper methods that hide the stream manipulations so I don't have to remember them. Here's one that will read any file as an array of bytes. I've found this useful with both binary and text files when I didn't have to analyze the data inside--such as a simple file transfer. public static byte[] GetBytesFromFile(string fullFilePath) { // this method is limited to 2^32 byte files (4.2 GB)
} How to read a audio file from array of bytes. 1.Get the byte array. 2.Read it in memory stream. 3.Pass it into object of System.Media.SoundPlayer . 4.Play it. byte[] bytes = GetbyteArray();