Hi, my Application loads a CSV file and transforms the Data in it. This Data is stored in a List<> I would like to be able to encrypt every row in this list with a public key and then save it to a new CSV file. After I saved the file with the encrypted data, I would like to encrypt this file again with a public key. The public key is a string like:
Quote:
MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAMDm/5kIEchm1R0oU46TuKEE7b5HQMgJ
1O8IdB3YqmMa9mTy178c0JkPfiigbDnGNfHlLX4DQ7KX2TZ+suK1Vj8CAwEAAQ==
and the private key for the decryption looks like this
Quote:
MIIBOwIBAAJBAMDm/5kIEchm1R0oU46TuKEE7b5HQMgJ1O8IdB3YqmMa9mTy178c
0JkPfiigbDnGNfHlLX4DQ7KX2TZ+suK1Vj8CAwEAAQJAdFRZ242UO8hXyMei7B6F
fwUb4l3R4VCcirIMZFtfFXgHC2lrrSB5IWWoNTCgiv7qf/V09uic5SPIMSp0EiU4
gQIhAN9RtawpAYsdMWwCY97pmEzfATYI84fNfQ0+tJdXipAfAiEA3SHFb1LReqoI
hsAH1zJppfmkUEyKozRljOKDdP4h9eECIArMZ62Aehug+L/RScUApKWq7uMPAb+i
Vxap3o+m4wNfAiEAj6JlBRdtW9jgKu7G6QAk4ZtTIJlnH/Vj1Ow46SA9XOECIQCF
sRjnfML4Pdp0oR1fh/YHJgCdxPBcGz8AoIwsfG1GgA==
I got this keys from this website:
[
^]
A Bonus would be if I would be able to generate my own keys with a seperated very small application, but thats just a bonus, right now my main problem is that I would like to be able to encrypt and decrypt my csv file in a console app.
Thank you very much for your time and maybe help.
What I have tried:
I found several examples that do what I want but dont, like:
Public Key RSA Encryption in C# .NET[
^]
Simple encrypting and decrypting data in C#[
^]
and couple more on other sources I found with google, but nothing realy helped me.
Right now I'm using the 2nd link and I get an error when I try to decrypt my file.
Quote:
System.Security.Cryptography.CryptographicException: "Characters are invalid and can not be removed."
When I use the application from the first link, it pretty much does everything what I need but I dont really understand the source and I need it for a console application.