Is it possible to use pure Encrypting and Decrypting keys in asymmetric cryptography instead of private and public keys?
Is it possible to use pure Encrypting and Decryptin开发者_如何学运维g keys instead of private and public keys? As I know in .Net asymmetric RSA implementation private key RSAParameters parameters = (new RSACryptoServiceProvider()).ExportParameters(true)
is a superset of public key. And using private key we can both encrypt and decrypt our data. But I need key only for decrypting data. How to do it?
I experimented on nulling RSAParameters fields, but RSACryptoServiceProvider object can't import such parameters.
If you're asking what I think you're asking, you're solving a problem like this one:
You encrypt some data. You send it to clients, and want them to be able to decrypt it, but you do not want them to be able to encrypt anything, because then they could convince other clients that they're you.
Is that close? Can you tell us what problem you're solving?
For the rest of the folks on the thread, it sounds pretty clear the OP wants a decrypt-only key, instead of the usual encrypt-only public key.
Edit: the comments are correct in that a private key can't be used to encrypt, but it's not that difficult to generate the public key given the private key. If you have the private key, you effectively can have both keys.
Edit 2: OP, you should probably look into digital signatures. You could sign a message (using the private key) and then confirm the signature with the public key, which I think is exactly what you asked for.
For decoding data you need either the public or the private key. Depends on how it was encoded.
Stick with the standard patterns, and just be careful never to distribute your private key.
From your comments (to various answers), you just need signing (of a Hash of your data). It is no use to encrypt data with a key that everybody can have.
There are standard functions and patterns for signing.
I think you need to use the private key for decrypting and the public key for encrypting.
The receiver (decrypter) sends it's public key to the sender (encrypter). So everyone can send messages, only the receiver can read them. It this what you need?
If you need to make sure that the message come from a certain sender, it needs to add a signature by using its own private key. The receiver can verify this by using the senders public key.
If you want to make sure that the private key-holder cannot encrypt something such that the result is indistinguishable from a message sent by the public key-holder, then you could simply double-wrap your data.
Simply have two key-pairs.
Side A gets the private key of key-pair 1, and the public key of key-pair 2. Side B gets the public key of key-pair 1, and the private key of key-pair 2.
Side B sends his/her/its message by first encrypting it with the public key of key-pair 1, and then the private key of key-pair 2.
Side A decrypts the result using the public key of key-pair 2, and the private key of key-pair 1 (in that order).
Side A can generate the public key of key-pair 1, but cannot generate the private key of key-pair 2, so side A cannot generate a valid message.
The inverse works in the other direction.
Down-side: If you have a central person (or server) that every other person (or computer) is communicating with, each party needs their own private key, and they need to share the corresponding public key with the central person (or server) they are communicating with.
精彩评论