c# - Encrypt a file and send it through -


i need encrypt file aes 192 , send client via socket. i'm using code encrypt file:

string outputfile = "crypted";              //confidentiality             rijndaelmanaged aes192confidentiality = new rijndaelmanaged();             aes192confidentiality.keysize = 192;             aes192confidentiality.blocksize = 192;             aes192confidentiality.iv = confiv;             aes192confidentiality.key = confkey;             aes192confidentiality.mode = ciphermode.cbc;             filestream inputfilestream = new filestream(par.getfilepath(), filemode.open, fileaccess.read);             filestream outputfilestream = new filestream(outputfile, filemode.create, fileaccess.write);             byte[] inputfiledata = new byte[(int)inputfilestream.length];             inputfilestream.read(inputfiledata, 0, (int)inputfilestream.length);             cryptostream encryptstream = new cryptostream(outputfilestream, aes192confidentiality.createencryptor(), cryptostreammode.write);             encryptstream.write(inputfiledata, 0, (int)inputfilestream.length);             encryptstream.flushfinalblock();             encryptstream.close(); 

i'm wondering how can send encrypted temporary file through socket, receiver can reconstruct file , decrypt it. can give me tutorial or guide ? thank in advance

you can create instance of networkstream socket , call encryptstream.copyto(mynetworkstream);


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -