Reputation: 1
Questions about public keys:
Can a PUBLIC key be created such that it can work for both encryption and decryption? (of the same object/code, of course)
Can a PUBLIC key be created for decryption only? (when encryption is done with the PRIVATE key). I mean, such that if used for encryption it CANNOT decrypt what it has encrypted?
Upvotes: 0
Views: 145
Reputation: 9806
A Public key is exactly what it describes. Public. If you want a public key that both encrypts and decrypts, then it is no longer a public, nor asymmetric key. It's just a standard symmetric key, for algorithms like AES etc. Does this sound like what you want to do?
For your second question, a Public Key and Private Key are derived from a mathematical relationship. The RSA Private Key actually contains the Public Exponent and Modulus (among other components) that can be used to directly create the Public Key. Thus, if you have the Private Key, you also have the Public Key. Your second scenario is then not secure.
You might be interested in signing data using a Private Key and verifying the data using a Public Key. This is common in SSL Certificates.
Upvotes: 1