Reputation: 4693
I am relatively new to PKI, certificates and all related stuff.
As far as I understand in public-key cryptography one encrypt with a public key and decrypt with a private key. Only one private key can correspond to any public key but the opposite is not true. Is it correct? Or is it one to one mapping?
So, the way digital signature works is that the content of a certificate is hashed and then "signed" with a private key. The signature is verified then with the corresponding public key.
So, here is where I get confused. What is the difference between encrypting a message with a public key and signing a message digest with a private key?
Upvotes: 24
Views: 32989
Reputation: 74641
Encryption: Uses public keys to encrypt and private keys to decrypt e.g. DES, AES Digital Signature: Uses private keys to sign and public keys to verify e.g. DSA, RSA
Encryption is primarily concerned with confidentiality. e.g. SSL
Signing focuses on integrity and authenticity, providing assurance that the document hasn't been tampered with and verifying the identity of the signer. e.g. JWT signing
Authorities:
Algorithms:
DES (Data Encryption Standard) and Triple DES (a stronger variant of DES), AES(Advanced Encryption Standard) are Symmetric key cryptosystems. Which uses the same key for encryption and decryption.
DSA(Digital Signature Algorithm) and RSA(Ron Rivest, Adi Shamir and Leonard Adleman) are public-key cryptosystems, which are widely used used for secure data transmission. DSA provide only digital signatures and RSA provide both digital signature and encryption.
Upvotes: 15
Reputation: 6749
Any private key has one public key and any public key has one private key its always one to one mapping.
Signing the message is only create a finger print for the message just to make sure that the content hasn't been altered, but it has no effect on the message it self and the message will never be encrypted.
While encrypting the message will do the encryption. you can encrypt a message and sign it at the same time.
Upvotes: 2
Reputation: 1815
I think information security objectives are essential to realize the difference between message encryption and signing. To define a few objectives:
Message encryption provides confidentiality.
Message signing binds the identity of the message source to this message. It ensures data integrity, message authentication, and non-repudiation altogether.
I find the fourth objective, non-repudiation, I find it distinguishing so please allow me to elaborate on it. Alice could at some point in time deny having signed a message or Bob could falsely claim that a message signature was produced by Alice. A digital signature permits an unbiased trusted third party (agreed upon in advance) to resolve the dispute without requiring access to the signers' secret information (private keys).
The digital signature system you mention in your question is referred to as digital signature from reversible public-key encryption. All in all, any digital signature scheme should have the following properties:
As for encryption systems, Kerckhoffs defined a set of requirements that are still, for the most part, useful today. Please read up on the wiki.
Regarding the types of functions that are used for key generation and encryption/decryption, let's again give a few definitions:
f: X -> Y
is one-to-one if each element in Y
is the image of at most one element in X
.f: X -> Y
is onto if each element in Y
is the image of at least one element in X
.f: X -> Y
is one-way if f(x)
is easy to compute for all elements in X
but for all elements y
in Y
it is computationally infeasible to find any x
such that f(x) = y
.f: X -> Y
in which the knowledge of extra information (trapdoor information) makes it feasible to find for any y
in Y
, an x
in X
such that f(x) = y
.A bijection is used as the tool for encrypting messages and the inverse bijection is used to decrypt.
A trapdoor one-way function is used for key pair generation in public-key cryptosystems and digital signature schemes.
A Trapdoor Concrete Example
In RSA, the public key is (e,n)
where n =pq
and p
and q
are two large, distinct prime numbers . e
is randomly chosen in the range 1 < e < (p - 1)(q - 1)
. Given the knowledge of (p - 1)(q - 1)
, the unique private key d
is obtained through the application of the extended Euclidean algorithm. It is a trapdoor one-way function that enables us to obtain d
from (e,n)
.
If you don't know (p - 1)(q - 1)
and still would like to discover d
, then you need to factor n
. If p
and q
are large and carefully chosen, factoring n
should be intractable. This is the RSA problem (RSAP).
But where is the trapdoor? As you may have noticed, the trapdoor is the factors of n
. If you know these factors you can easily invert the one-way function and reveal d
.
Upvotes: 32
Reputation: 96009
As already mentioned in the other answers, public and private key are coupled with each other. Actually in many encryption context you have a pair of numbers with certain properties and can choose which you want to use as private and which as public key. Thus, there is a certain degree of uniqueness here. (Details may vary according to the algorithm in question.)
When talking about PKIs, though, you often do not consider public keys but certificates which essentially are bundles of information (issuer, subject, validity interval, usage constraints, ...) with a public key. When creating certificates, you of course can build different certificates for the same public key.
Thus, while private and public keys essentially are one-to-one, private keys and certificates may be one-to-many.
Maybe this is the cause of your one-to-one confusion.
Upvotes: 1
Reputation: 2167
Message Encryption makes the whole message unreadable to anyone but the owner of the corresponding private key.
When you sign a message, then it creates something like a checksum of the message content in combination with data from the key, which can be verified against a public key. This does not make a message unreadable to anyone, but can verify that the message really originated from the sender and was not altered since.
Of course this requires you to trust the public key, but that is another story.
To your first question: AFAIK it is theoretically possible to create a public key collision, but highly unlikely.
Upvotes: 6