I'm just getting started with Visual Basic .NET and I'm currently stuck on the following problem: how can I encrypt/decrypt a file with asymmetric encryption?
Essentially, I'm trying to figure out how I can write the following pseudocode in VB:
Function EncryptFile(path_to_file_to_encrypt, public_key)
file = ReadFile(path_to_file_to_encrypt)
encrypted_file = Encrypt(file, public_key)
SaveToDisk(encrypted_file, "C:\Encrypted\encryptedfile.xxx")
End Function
Function DecryptFile(path_to_encrypted_file, private_key)
encrypted_file = ReadFile(path_to_encrypted_file)
file = Decrypt(file, private_key)
SaveToDisk(file, "C:\Decrypted\file.xxx")
End Function
The file I'm encrypting/decrypting is an Access database file (i.e. binary), if that makes any difference.
I understand there are containers for private keys, but it looks like the MSDN tutorial is sufficient for me to figure this bit out. I assume I can hard-code the public key in my code (it won't be changing).
Any help would be appreciated!