• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Client - Server - Client cryptography

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello.
Clients use assymetric cryptography to encrypt/decrypt data. But i also need to check the integrity of the messages, so i use digest. My question is, how do i achieve confidentiality when i have to pass the message non encrypted, in order for the server to be able to check its digest? Does the server participate in the encrypt/decrypt process? If yes, what keys does it use?
Thanks in advance
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch.

when i have to pass the message non encrypted, in order for the server to be able to check its digest


I'm not clear on why the message would be unencrypted - you said encryption being used? Can't the server decrypt the data and then compute its digest?

An alternative would be to compute the digest on the client and then send only the digest to the server. But that depends on what the purpose of encryption and digest are, and from where to where each is sent - which are details we don't know.
 
liakos liakoz
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ulf Dittmer wrote:Welcome to the Ranch.

when i have to pass the message non encrypted, in order for the server to be able to check its digest


I'm not clear on why the message would be unencrypted - you said encryption being used? Can't the server decrypt the data and then compute its digest?

An alternative would be to compute the digest on the client and then send only the digest to the server. But that depends on what the purpose of encryption and digest are, and from where to where each is sent - which are details we don't know.



First of all, thank you for the quick reply.
Im new to cryptography so i wasnt sure if the server could participate in the cryptography process. So if i understand right, you suggest that client1 sends the encrypted message and the digest to the server, then the server decrypts the message, digest it and then compare the digests. Then encrypt it again and send it to client2 . But now my question is, what keys does the server use to encrypt/decrypt messages? I use public/private keys for the clients(encrypt with the recipients public key and then the recipient decrypts it with his private key). Should i use the same method for the server as well, or is there another more efficient/right way? I use RSA.
Thanks again and sorry for my English
 
author
Posts: 23951
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

liakos liakoz wrote:
Im new to cryptography so i wasnt sure if the server could participate in the cryptography process. So if i understand right, you suggest that client1 sends the encrypted message and the digest to the server, then the server decrypts the message, digest it and then compare the digests. Then encrypt it again and send it to client2 . But now my question is, what keys does the server use to encrypt/decrypt messages? I use public/private keys for the clients(encrypt with the recipients public key and then the recipient decrypts it with his private key). Should i use the same method for the server as well, or is there another more efficient/right way? I use RSA.
Thanks again and sorry for my English



Well, in this case, isn't the server the recipient? So, the server randomly generates a key pair, send the public key to the client, who then uses it to encrypt the payload (which includes the message and digest). When the server then forwards it another client, then the server becomes the sender, and other client is the recipient.

Henry

 
Henry Wong
author
Posts: 23951
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

liakos liakoz wrote:
Im new to cryptography so i wasnt sure if the server could participate in the cryptography process. So if i understand right, you suggest that client1 sends the encrypted message and the digest to the server, then the server decrypts the message, digest it and then compare the digests. Then encrypt it again and send it to client2 . But now my question is, what keys does the server use to encrypt/decrypt messages? I use public/private keys for the clients(encrypt with the recipients public key and then the recipient decrypts it with his private key). Should i use the same method for the server as well, or is there another more efficient/right way? I use RSA.
Thanks again and sorry for my English



Alternately, the server could just not be involved. The receiving client could just check the payload at it's location -- this will mean that the server could be sending corrupted data, but it could be caught before it is used.

Also, since the server never sees the unencrypted payload, you can argue that the confidential data is safer.

Henry
 
liakos liakoz
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So, server does not involve at all (only forwards the payload) and we are still safe? Good. Thank you guys, i appreciate your help.
If i need anything else, ill come back later. Cheers
 
Henry Wong
author
Posts: 23951
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

liakos liakoz wrote:So, server does not involve at all (only forwards the payload) and we are still safe? Good. Thank you guys, i appreciate your help.
If i need anything else, ill come back later. Cheers



Well, it definitely works. Is it safe? That depends on whether the clients and servers trust each other. Keep in mind that encryption just means that the payload is safe during transmission. It doesn't mean that the endpoints are trusted. To do that, there needs to be some sort of authentication mechanism... which is another can of worms.

But yes, the data should be safe from third party viewing while in transit.

Henry

 
liakos liakoz
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello again guys.
So the assignment is : Im given a Client-Server-Client communication program and i have to add code to it in order to achieve :
1) Confidentiality
2)Integrity
3)Authentication
4)Non repudiation
What I've done so far is : Client1 sends a message that contains the encrypted text, the digest, the self signed certificate of the client and the digital signature. Server accepts the message, checks if the public key of the certificate that is obtained from the keystore(i have a keystore that contains all three certificates) is the same with the public key of the certificate that is sent with the message, then decrypts the cipher and checks if the digests are the same and it also checks if the digital signature is valid. The Server then encrypts the message again, sign it and sends it to Client2. (message now contains the cipher, the digest, the servers certificate and the digital signature of the server). Client2 accepts the message, checks the keys, decrypts the message, checks digest and digital signature and if everything is alright then we are ok.
What do you think of this implementation? Have i achieved all 4 subjects? If not, what am i missing, what should i add/delete to the communication and why?
Thank you
 
Bartender
Posts: 1166
17
Netbeans IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm not convinced you have achieved 'authentication' since you are using self signed certificates and have not explained how the clients and servers exchange these certificates in a secure and authenticated manner.

P.S. When you say "checks if the digests are the same and it also checks if the digital signature is valid" are you talking of the digest of the cleartext and the signature of the cleartext? If so then the separate digest is redundant since the signature is in effect the encryption of the digest by the private key.
 
liakos liakoz
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Richard Tookey wrote:I'm not convinced you have achieved 'authentication' since you are using self signed certificates and have not explained how the clients and servers exchange these certificates in a secure and authenticated manner.


Thanks for the reply.
So how do i achieve authentication?I just send the certificates inside every message. What should i do instead and why?
PS: I use self signed certificates and im able to retrieve every certificate i want from the keystore
PS2: Is non repudiation achieved with the implementation i described in my previous message?
 
Richard Tookey
Bartender
Posts: 1166
17
Netbeans IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

liakos liakoz wrote:
So how do i achieve authentication?I just send the certificates inside every message. What should i do instead and why?


One uses a reputable Certificate Authority (CA) such as Verisign. The CA is then responsible for authenticating that a certificate belongs to a particular principal (see note 1).


PS: I use self signed certificates and im able to retrieve every certificate i want from the keystore


If you use a CA then the CA master certificate will be in the trust store and a presented certificate will be authenticated by authenticating the chain. There is no need to have the principal's certificate in the trust store unless you want to limit access to only those principal who have a certificate in the trust store.


PS2: Is non repudiation achieved with the implementation i described in my previous message?


Since the document can only be signed by the person holding the private key (the principal) and it is assumed that the private key is known only to the principal then as long as a CA signs the public key and the signature is valid then the principal cannot deny having sent the document.

Note 1 - a CA only authenticates that a particular certificate is owned by a particular principal but most definitely does not indicate that the principal is trustworthy! Saddam Hussein could have had his certificate authenticated by a CA but would you have trusted Saddam Hussein?
 
liakos liakoz
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The assignment says that i have to use self signed certificates, not certificate signed by a CA
 
Richard Tookey
Bartender
Posts: 1166
17
Netbeans IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

liakos liakoz wrote:The assignment says that i have to use self signed certificates, not certificate signed by a CA



I can think of several approaches that avoid using a third party CA but since it is your assignment I will let you suggest an approach.
 
liakos liakoz
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If the moment that a client connects to the server, they exchange certificates, would it make it any better?
 
Richard Tookey
Bartender
Posts: 1166
17
Netbeans IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

liakos liakoz wrote:If the moment that a client connects to the server, they exchange certificates, would it make it any better?



So how do you know if the client is one you trust and wish to allow access to the server?
 
liakos liakoz
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Richard Tookey wrote:

liakos liakoz wrote:If the moment that a client connects to the server, they exchange certificates, would it make it any better?



So how do you know if the client is one you trust and wish to allow access to the server?



How can i possibly know if im not using certificates signed by a CA? Maybe if a create a root certificate which signs the certificates of the two clients?maybe the certificate of the server too?
 
Richard Tookey
Bartender
Posts: 1166
17
Netbeans IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

liakos liakoz wrote:

Richard Tookey wrote:

liakos liakoz wrote:If the moment that a client connects to the server, they exchange certificates, would it make it any better?



So how do you know if the client is one you trust and wish to allow access to the server?



How can i possibly know if im not using certificates signed by a CA? Maybe if a create a root certificate which signs the certificates of the two clients?maybe the certificate of the server too?



Just one possibility -

a) All parties create self signed certificate and copy them to a memory stick or CD or floppy.
b) The parties meet face to face taking with them their self signed certificate copies and proof that they are who they say they are and proof that they have the right to host a site or access a site.
c) Each party presents copies of relevant certificates to those parties who need them.
d) Once back at base the certificates are stored in any repositories that need them.

 
liakos liakoz
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What i did eventually is : every party (both clients and server) has its own keystore which contains their self signed certificate. Every party also has its own truststore, which contains the certificates(public keys) of the parties that they trust (done with import-export certificates using keytool). So when a client connects to the server, they exchange certificates and then they check if the public key of the certificate that they received matches with the one they have in the truststore. Is that good enough to achieve mutual authentication using only self signed certificates?
Thanks.
 
Richard Tookey
Bartender
Posts: 1166
17
Netbeans IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

liakos liakoz wrote:. Is that good enough to achieve mutual authentication using only self signed certificates?
Thanks.



What guarantee have you that a particular certificate you have in a trust store can be trusted? Based on what you say I don't think you have mutual authentication!
reply
    Bookmark Topic Watch Topic
  • New Topic