# Genuine encryption from only one source?

Is there any technique so that if I encrypt data, the ciphertext would be genuine and if someone else tries to encrypt the same data the ciphertext could be determined as fake or just invalid?

I want to create a network in which the user has to register to get a ciphertext (like a token) and only after getting a genuine ciphertext would they be allowed to communicate with other users in the network. The ciphertext would contain their identity.

However, if I simply use any simple encryption method, the user would be able to fake their identity by encrypting the data in the same format and method. I do not want to use a server/database to verify the identity. That is why I was thinking of ways to disallow fake ciphertexts.

If this is possible can you suggest a solution to achieve this? If not can you suggest an alternative?

-
Does a standard digital signature fit your scenario? –  CodesInChaos Oct 21 '13 at 20:32
If no, does a strongly unforgeable signature scheme fit your scenario? $\;$ –  Ricky Demer Oct 21 '13 at 20:48
I don't have much knowledge on encryption. @RickyDemer I think this is what I'm looking for however I cannot understand the document. Could you tell me what this does? –  Saif Ur Rehman Oct 21 '13 at 21:31
@Saif : $\:$ Do you know what (cryptographic) digital signatures are? $\;\;\;$ –  Ricky Demer Oct 21 '13 at 21:48
Cross posted: stackoverflow.com/questions/19503224/… please note that cross posting is discouraged. –  mikeazo Oct 21 '13 at 23:17

I think the solution to your problem is a digital signature as CodesInChaos pointed out. Here is how it would work:

When a user registers with your server they are given a token which will consist of (at a minimum) the user's id. The server also uses its private key to digitally sign the token (or more likely a hash of the token).

Now, say user1 and user2 have done this and now want to communicate. They each send their token and digital signature to the other user. They each take the token and signature that they received from the other user, and use the servers public key to verify that the signature was correct. If so they proceed to communicate.

There are some things you will want to think about before using this, however. You might want to kick people out of the network. That will require some additional work.

-
Thank you I understand now. However if I wanted to kick people out of the network what would I do for that? –  Saif Ur Rehman Oct 22 '13 at 3:12
The token could have an expiration date, or users could download from the server a revocation list. –  mikeazo Oct 22 '13 at 15:54
Is it possible that if I publish my public key, that is used to generate tokens, with a program, the user would be able to create a signature with that key? –  Saif Ur Rehman Oct 22 '13 at 17:23
Signatures can only be created with the private key. Publishing the public key will not allow them to sign anything. –  mikeazo Oct 22 '13 at 17:32
Ok thank you :) –  Saif Ur Rehman Oct 22 '13 at 17:50