I'm trying out some encryption and I'm wondering if I'm doing it correctly.

The idea is a two layer encryption ensuring the sender is the sender, while having the proxy not knowing what the content of the message is from the sender (since the proxy knows the id of the sender). Then remove the ID of the sender and send the data to the LAST receiver which only can access the message and not the id of the sender.

I have a client that:

  1. Encrypts a message with a symmetric key, and only the message content.
  2. Encrypts the symmetric key with the LAST receiver's public key.
  3. Encrypts the encrypted message again with a Proxy public key.

Proxy receives the encrypted data and should just verify that the sender is the actual sender. Then remove the sender's id and send it to the LAST receiver only having an encrypted message with no id of the sender which it can decrypt using the symmetric key.

What should I sign, and how should I encrypt the encrypted message and private key? In one or two separate?

  • 2
    I think you have a multi-layered X/Y problem. It looks like you are throwing solutions together to hopefully solve a problem, but the problem is not defined.
    – schroeder
    Commented Mar 16, 2017 at 16:19
  • The design pattern you are looking for here is a "message authenticator". That's the role the proxy is playing. You can authenticate encrypted messages.
    – schroeder
    Commented Mar 16, 2017 at 16:31
  • Message should be encrypted with Bobs pub-key. Alice ID should be encrypted wtih Proxy public key. Proxy verify Alice ID, removes it. Does it make sense to do that? The ID should be encrypted as well. What should I sign? The message or the Alice ID?
    – sweep
    Commented Mar 16, 2017 at 16:36
  • ... sure, I have no idea why you need to encrypt the id, if it is being stripped anyway, unless Bob can see the communication between Alice and the proxy, but in that case, you should use channel encryption (TLS)
    – schroeder
    Commented Mar 16, 2017 at 16:39
  • @schroeder is correct. If also you want to keep the identity of the provider hidden, you can encrypt traffic between the the client and the proxy.
    – JimmyJames
    Commented Mar 16, 2017 at 16:40

1 Answer 1


You are performing a lot of unnecessary steps.

What you appear to want is to maintain encryption between Alice and Bob, but to use a 3rd party to verify that Alice is the sender.

You could accomplish this by:

  1. Alice encrypts message with Bob's public key
  2. Alice signs the message with Alice's private key (or send authentication token encrypted with Proxy's public key)
  3. The Proxy receives and verifies the signature (or auth token) with Alice's public key
  4. The Proxy strips the signature then passes it on to Bob.

That covers all your requirements more simply. One encryption. Sender verified. Sender remains anonymous to receiver.

  • Ok, ur right that is more simple. I guess that your solution is assuming TLS/SSL is used to hide her ID from unwanted parties? Since I need her ID to look up her public-key. At least in my implementation, i dont know about other ways to do it.
    – sweep
    Commented Mar 16, 2017 at 17:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .