# Is private key encryption to verify identity a weakness?

I'm trying to learn about cryptography and have discovered that you can use asymmetric key encryption to verify your identity by encrypting something with your private key, but isn't that a security vulnerability?

This how I understand it:
* Users: A, B & Eve (A want to send a message to B, Eve is always listening)
* Both users each have a corresponding public/private key pair.
* Both users know about each others public key.

A ---> B-pub(A-priv(message)) ---> B

Can B or Eve decipher what A-priv is now?

Values known:
* To A: B-pub, Message, (A-priv & pub)
* To B: A-pub, [A-priv?], message, (B-priv & pub)
* To Eve: A-pub, B-pub, B-pub(A-priv(message))
(have I missed any values?)

Assuming Eve can gain access to B-priv, can she then figure out what A-priv is from the message?

• @schroeder #1, To decrypt something encrypted with a public key you normally must have access to the private key. What I mean with "solve" is that Eve somehow can overcome the B-pub encryption either being by haveing acces to B-priv or some other kind of "black-tecno-magic". – Sebastian Norr Oct 16 '17 at 22:32
• (1) you can't decrypt PK-encryption without the private key; if there were 'black-tecno-magic' everything in the world would already have been decrypted and practically all economic activity would have stopped (2) if you are thinking either key is somehow recoverable from the message, B-pub(x) and A-priv(x) means the result of encrypting or signing with the key; it does not include the key used at all. – dave_thompson_085 Oct 17 '17 at 0:44
• What I man with 'black-tecno-magic' is some kind of existing real world hacking concept that is far beyond my level of knowledge, as they say "any sufficiently advanced technology is indistinguishable from magic". – Sebastian Norr Oct 17 '17 at 23:36

• Private key can only decrypt things encrypted by public key
• Public key can only decrypt things encrypted by private key.

If party A encrypts using party A's private key, and then encrypts with party B's public key `enc(enc(message, privatePartyA), publicPartyB)`, then only party B can decrypt the "outer encryption". While everyone can decrypt the "inner" encryption. `dec(dec(message, publicPartyA), privatePartyB)`

Eve would be able to decrypt the inner layer with party A's public key, but since it has also been wrapped around an encryption with party B's public key, this is not possible. Only party B can unwrap the outer layer, to get to the nougat center.

In your scenario, B is a completely unnecessary factor. You could have stated the entire problem with only `A-priv(message)` because there is no relationship between A's and B's keys.

Then your question becomes: is `A-priv` at risk if used to encrypt? And this answer is simple (and easily researched). No. You can encrypt with either key and the corresponding key is unaffected.

• No, * With A-priv(message) anyone (with A-pub) can read the message. * With B-pub(A-priv(message)) then only B can read the message by using the B-priv key to remove the first outer layer of encryption. But I think you kind of answered the question with: "No. You can encrypt with either key and the corresponding key is unaffected." – Sebastian Norr Oct 17 '17 at 23:29
• But your question is specifically about the risk to A-priv, which means that all the B keys are not a factor ... You even state that Eve has both B-keys (or equivalent), which means that B is removed from consideration. – schroeder Oct 18 '17 at 9:00
• Yeah, in that last case where Eve has the B-priv then I assume it would be equal to A-priv(message), but in the scenario above in the list of known values she don't know B-priv yet so there it is B-pub(A-priv(message)). – Sebastian Norr Oct 19 '17 at 9:33