Take the 2-minute tour ×
Cryptography Stack Exchange is a question and answer site for software developers, mathematicians and others interested in cryptography. It's 100% free, no registration required.

After reading about public/private key cryptography, there are still a few points I don't really understand.

Based on the way (I understand) challenges work, the public key is used to encrypt a sequence which the private key can be used to decrypt:

  1. When a key pair is freshly generated, does it matter which key that is chosen as the private key since the opposite key can be used for encryption?
  2. Does this apply to all known and/or hypothetic asymmetric encryption algorithms?
share|improve this question

1 Answer 1

up vote 10 down vote accepted

This depends on the public-key system (algorithm).

For RSA, technically the private and public key (i.e. the exponents, the keys share the same modulus) are symmetric, you can swap them, and it still works.

But you usually don't want to do this: The public exponent is usually a small number (like $3$ or $2^{16} + 1$) in order to speed up encryption/signature verification, and can thus be easily guessed. You don't want this property for a private key.

Also, in practice the private key is often not just the exponent $d$ and modulus $n$, but also the factors of the modulus (i.e. $p$ and $q$), in order to speed up decryption or signature. That kind of key certainly doesn't work as a public key.

For other public-key systems (like ElGamal/DSA, Diffie-Hellman, or EC), the relation between public and private key is not symmetric at all. In the examples mentioned you have a private key $x$ and a public key $y = g^x$ (with some kind of exponentiation operation which is difficult to reverse).

In these cases, you certainly can't swap out public and private key.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.