I am using CryptoApi to encrypt a file (asymmetric encryption). Everywthing is ok but when the file is large, it can not encrypt it. I searched and found that I must encrypt block by block. Except for the last block the Final
flag in CryptEncrypt
function must be false.
I know all of above conception but I dont know how I can to implement them. I mean I dont know how read, encrypt and write block by block. Can you give me a real code example.
Update:
I used the code of this website: http://blogs.msdn.com/b/alejacma/archive/2008/01/28/how-to-generate-key-pairs-encrypt-and-decrypt-data-with-cryptoapi.aspx