How CA on my device check that a digital signature is genuine or fake?. If a hacker gets my digital signature, can they combine my digital signature and their own public key and
Since the first answer, I have updated this further to add further details and clarity.
Background on Certificate Authority (CA) & Certificates
Digital Signature provides:
Digital certificates are used to digitally sign documents. The certificate is sent along with the signed document, so that the recipient can verify the authenticity and integrity of the signed document.
Digitally signing a message means computing a hash (one-way) of the message using a pre-defined algorithm and then encrypting the hash with the private key of the certificate owner. since, no-one is supposed to know the private key of the certificate other than the owner himself/herself, no-one else can produce the same signature that can be decrypted with the public key of the certificate.
Digital signature thus provides 3 things:
Authentication - By verifying the digital certificate (using the certificate chain as mentioned above), the recipient knows that the message has been indeed sent by a trusted party
Non-Repudiation - The message sender cannot deny later that the message was not sent by it, because nobody else has the private key of the message sender and therefore nobody else can sign the message with the same private key
Integrity - Since the hash of the received message computed by the recipient is the same as the hash (after decryption using sender's public key) sent by the sender (after decryption using sender's public key), it proves that the client has received the exact same message as sent by the sender, otherwise if the message has been tampered by a deliberate attack or an unintentional network error, the hashes would have been different.
Digital Signature Creation Digital signature is created by
Signature Verification
Any recipient of a digitally signed document would want to verify the signature to ensure the authenticity and integrity of the document. Verification can be done in the following way:
Compute the hash of the message using the same hashing function
Decrypt the signature using the public key (available in the certificate) of the sender
The computed hash and the decrypted hash should be the same
Therefore as long as the certificate private key is not compromised, it is a robust mechanism.
Some Technical Details
Two important standards with respect to certificates are: X.509 and PKCS12. The details can be found in the linked Wikipedia pages.
Using the Java keytool
utility anyone can create a self-signed signature. However, such certificates or signature will not be trusted anywhere unless the recipient add the certificate in their device trust store.