Kmail encryption and signing key?

Hi,

So I need to send an encrypted email using a pgp-key. So far I created my own public-private keypair and put the public key on a keyserver. I use Kmail to send emails.
So now Kmail asks me for a signing key and a encryption key and I am confused. Do I choose my one public key for both of those?

Also where do I add the public key from the recipient to encrypt the email in the first place.

Thanks for reading.

You use your private key for the signing and the recipients public key for encryption.

Thanks. Okay but the problem is that it is in the settings not when I send the email. So it can be one of two things.
A) It really is like this and I would have to change the settings every time I send an email to another person.
Or
B) The encryption and the signing key are two different or the same key that I have to provide and the recipients public key is asked for every time I send an email.

Answer B) seems more likely to me, because I think it would be very odd to change the settings every time I send an email. But this would raise the question what the two keys actually do and if they have to be two distinct public keys.

You normally publish your public key or even put it in the signature. Best is to publish it on a trusted public key server, the standard ones in the GPG key management of your distro will do nicely. Those servers will also provide the keys of the recipients if they answer per encrypted mail. You then need your private key to decrypt the mail sent to you, like the mail you've encrypted using the public key of the recipient can only be decyphered by the recipient with his private key. The GPG key management of KMail will find the public key of the recipient on a public key server when you encrypt a message to him, and if not, will tell you that there is no such key.

Okay thanks. I think I understand this, however KMail demands of me 2 keys in the settings. I think I figured it out.... a little bit.
The signing key is for authentication, to make sure that it is really me, When signing I encrypt the message with my private key to make sure that it really is me.
The encryption key is for well encrypting the message to make sure that only the recipient can decrypt the message.

If this is the case, don't people need 2 public keys from the other person. One for encryption when sending a message to them and one for authentication when receiving messages from them. And if yes why are there no signing key servers but only encryption key servers. Should I put two public keys online?
When I send myself a signed email. I get a .asc file, which is for authentication, But how do I use this file for authentication?

You never encrypt a message with a private key.

You need your private key to verify your signature, KMail will look for your private key on 2 occasions: to verify that it's there to make sure it's you, and to decrypt messages that are addressed to you.

You need the public key of the addressee to encrypt messages to him, whereas the signature of the message requires both your public an private key: you public key so that the GPG-client of the addressee can look up your key to verify that it's you who sent the message, and your private key so that your own GPG-client can verify the signature.

Therefore it's very important to understand that your private key shoudl never keave your own computer. Your private key should never be posted or distributed anywhere, because if someone else would get hold of your private key, that person could use it to identify himself as you.

Okay the way you describe it. There is only one key pair and this key pair is used for encryption and signing. Similarly here it is also described with just one key pair.
However when I duckduckgoed(google) it I found this suggesting that there should be separate key pairs for signing and encryption. Which I think is only possible if I have 2 public keys for everybody I communicate with, one for receiving messages from this particular person and verifying that its them and one for encrypting messages I send to them.

And thanks for your patience.

You have the public keys of the people you communicate with, either directly from them or from a key server. You need the public key from the addressee to encrypt the messages so that only they can decrypt it with their private key. A public key is like a lock that everyone can close, but only one person can open, the one that holds the private key corresponding to that public key. That is the encryption part.

Now for the authentication part, for every key pair that gets created, the public key is meant to be published or communicated to others, right? That key pair is linked to a certain email address. If a message is sent encrypted by you with your key pair, internally your GPG client in your email client will verify if it is really you by detecting the presence of your private key. Someone on a different computer pretending it's you wouldn't be able to send that message properly authenticated because he would not have your private key. In the same way, you know that a properly authenticated and encrypted message from someone who sends you a message, is sent by the person holding the private key of that other person.

So both parts together:
-in order to send someone an encrypted message, you need: 1. your own key pair, to demonstrate to the GPG client in your own computer that you are who you say you are, and 2. the public key of the addressee, so that you can encrypt the message in such a way that only the addressee will be able to read that message with his private key.
-in order to receive an encrypted message, you will need: 1. your own private key, to demonstrate to the GPG client in your own computer that you are the addressee of the message encrypted using your public key, 2. again your own private key to decrypt the message, and 3. the public key of the sender so that the GPG client in your computer can verify the signature with a key server to make sure that the sender is who he claims to be.

1 Like

My confusion is very simple. Should I generate 2 public-private-key pairs? One pair for encryption and one pair for authentication? The internet seems to say yes.

In order to send a message to Anna: I encrypt the message with Anna's public encryption-key and then authenticate the message with my private authentication key. Anna gets the message and can then verify the authentication with my public authentication key. And then she can decrypt the message with her private encryption key.

In order to receive a message: Anna encrypts the message using my public encryption-key and then authenticates using her private authentication key. I receive and authenticate with her public authentication key and decrypt with my private encryption key.

For this scenario to work I need two public keys from Anna. Anna's public encryption key to send her an encrypted message. And Anna's authentication key for receiving an authenticated message from her.
The other way around I would have to publish two public keys - authentication and encryption - to give people a chance to communicate with me.

You only need to generate one set of keys like the GPG module in KMail tells you to do when you create the keys. What is actually created is called a "certificate and key bundle". Your identity is usually guaranteed by a certification authority. This is done by attributing a key. It's all the same mechanism. You worry about too much. When you create a key with GPG, the only thing to worry about is that your private key is safe, that means that nobody gets it (e.g. full disk encryption on the system it is stored on), and a backup of the key in a safe place. GPG will take care of all the rest. KMail will alert you when an encrypted message does not contain a certificate, e.g. the sender is anonymous. You can alloy this in KMail of course, because it's important for instance that an investigative journalist can receive encrypted messages from anonymous sources.
Just think of the mathematical process behind the whole thing, what a certificate is, what a key is... it's a sequence that allows for a certain "hash" as it is called using a mathematical process, and that hash can only be resolved by means of the unhashing sequence, which is the private key. This system delivers both authentication and encryption.