简体   繁体   中英

PRIVATE key encryption in .Net

I am looking for a way to do private key encryption in C#.

I thought I could use the RSACryptoServiceProvider, but it only supports public key encryption.

The only thing I found on the subject was this project, but I would rather use something I can find in .net: http://www.codeproject.com/KB/security/PrivateEncryption.aspx

Please note I am not looking for signing.

Please note I require asymmetric encryption.

Any idea's?

Background story:

I am sending an encrypted file to another system which is running an application. The encryption is making sure the file cannot be altered (more or less) or viewed by anyone. The application is able to decrypt the file using the public key and do something with it.

I know pretty much anyone is able to get the public key from the application, this is not a problem in this case.

The encryption is making sure the file cannot be altered or viewed by anyone

Public Key Encryption - when done "by the book" - seperates encryption and signing ("cannot be altered"). In your case, use two key pairs, one within the application and one at your site. Encrypt the file using the public application key and sign the file using your private one.

This is a really widespread usage, I even like to call it "Best practice". As for the downvote, I can only guess that ruling out signing in your question triggered this.

It should not be done. Sign instead and use symmetric encryption.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM