Can a message that encrypted by public key decrypts by private key?
Can a message that encrypted by private key decrypts by public key ?
Are public key and private key generated using same algorithm ?
Can a message that encrypted by public key decrypts by private key? Can a message that encrypted by private key decrypts by public key ? Are public key and private key generated using same algorithm ? |
|||||||||||||||||
closed as off-topic by owlstead, Luc M, Duncan, Woot4Moo, Neolisk Jul 12 '13 at 19:47
|
|||||||||||||||||
|
Generally speaking they are not generated using the same algorithm. For RSA they could have been generated identically, but most cryptography libraries use a known public exponent. This means that if the private key is known that it is easy to deduce the public key. In many key formats the public key is included with the private key or can be calculated easily from the information in the private key format. Note that it is theoretically possible to generate a key pair where the public exponent has as much entropy as the private exponent. Some HSM's do allow such an operation. All in all you cannot switch keys without sacrificing security for encryption purposes.
In theory this could be the case if your cryptographic library allows it. Most libraries do not allow this however. First of all, as described above, it is not a secure operation. Furthermore, many libraries will assume that anything encrypted with a private key should use the padding mode for digital signature generation. In that case decryption is likely to fail; if it doesn't your ciphertext is not secure - so that's probably worse. From the PKCS#1 specification:
The padding mechanism that is applied before the primitive differs significantly for encryption and signature generation.
That is the underlying idea of asymmetrical encryption. That means "yes". |
|||||||||
|
In respective order: yes, yes and yes. Actually, only the public key can decrypt whatever was encrypted by the private one, and vice-versa. Also notice that the names "public" and "private" are just arbitrary ones. It's just that the best use for pairs of asymetric keys is having one of them secret and the other known by everyone else, so that:
|
|||||
|