Asymmetric encryption Keys
Can I encrypt using private key and decrypt with the public key ?
I found My answer: Asymmetric Encryption
I just did not Pay attention about the fact开发者_StackOverflow that the public key is public :D
You can encrypt whit private key, but in that case anyone whit public key can decrypt and this way it is meaningless to use such scheme.
Other party should send you his public key and then you encrypt with their public key and other party decrypt with their own private key.
For key exchange use protocol called Diffie Hellman. Public key is used mostly for authentication only.
You must use public key to encryption and private key to decription - it's point of RSA cryptography.
You can provide public key in some public place - then everybody can encrypt data and send you, but only you, with your private key can decrypt this message. You can use http://msdn.microsoft.com/en-us/library/system.security.cryptography.rsacryptoserviceprovider.aspx
more info: http://en.wikipedia.org/wiki/Public-key_cryptography#How_it_works http://en.wikipedia.org/wiki/File:Public_key_encryption.svg
精彩评论