Security and Cryptography
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsSystem AdministrationSecurity and Cryptography
Receive the tools necessary to be the rock star of your field. Our 12-month program teaches you the evolving world of multi-channel marketing as well as the complex issues and opportunities found in the industry.

ASP Free and Iron Speed Designer are giving away $5,500+ in FREE licenses. Iron Speed's RAD CASE toolset can save up to 80% of your coding time. One free license per week, one perpetual license per month!
Download and Activate to enter!

Web development can be a daunting task, even for specialists. There is a lot of information to absorb and a lot of technologies to learn in order to manage a superior website. When trying to learn the ropes, developers need a reliable source to introduce new ideas that can be easily implemented. When working on large projects, even web veterans may run into a technology or an aspect of a technology that they are unfamiliar with.

Learn More!


Download to Enter
| Contest Rules

Tutorials | Forums

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old February 5th, 2012, 03:04 PM
psyburg psyburg is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2012
Posts: 4 psyburg User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 28 m
Reputation Power: 0
Crypto Protocol Question - Crypto scheme

Hello

I am developing a live chat where all messages between users should be encrypted, saved on server database, but the server should not be able to decrypt the messages. If I use a public/private key system (with private key for decryption, computed client-side, based on user password, and public key, for message encryption, saved on server database), then everything is ok until the moment when an user changes his password. Then he will have another key (computed upon his new password), therefore he will be unable to decrypt his message archive.

Can you suggest me a cryptographic scheme that will work in my scenario?

Regards

Reply With Quote
  #2  
Old February 6th, 2012, 02:26 AM
leszek31417 leszek31417 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2011
Posts: 313 leszek31417 User rank is Corporal (100 - 500 Reputation Level)leszek31417 User rank is Corporal (100 - 500 Reputation Level)leszek31417 User rank is Corporal (100 - 500 Reputation Level)leszek31417 User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 1 Week 2 Days 18 h 56 m
Reputation Power: 0
First, do not involve passwords into encryption process,
only private keys.

But if this is a live chat between 3 or more persons
(say A, B and C), is A allowed to see B vis C posts ?


Reply With Quote
  #3  
Old February 6th, 2012, 02:35 AM
psyburg psyburg is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2012
Posts: 4 psyburg User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 28 m
Reputation Power: 0
This will be a two-person chat only. And only those two persons are allowed to view their messages (the server is not allowed to, all messages should arrive encrypted at the server; also all messages are saved encrypted in the database).

I want to find a solution to generate the keys for every person, and also to be able to read message archive if someone finds one`s key and he needs to change it (the archive will still be in the database, but encrypted with the old key)

Reply With Quote
  #4  
Old February 6th, 2012, 03:26 AM
leszek31417 leszek31417 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2011
Posts: 313 leszek31417 User rank is Corporal (100 - 500 Reputation Level)leszek31417 User rank is Corporal (100 - 500 Reputation Level)leszek31417 User rank is Corporal (100 - 500 Reputation Level)leszek31417 User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 1 Week 2 Days 18 h 56 m
Reputation Power: 0
So it is basically encrypted e-mail.

Why not to allow the server to act as a "postman",
sending, receiving and storing encrypted messages ?

For key generation you should read more info from www.
For example, PGP description.

Reply With Quote
  #5  
Old February 6th, 2012, 03:45 AM
psyburg psyburg is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2012
Posts: 4 psyburg User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 28 m
Reputation Power: 0
The problem is that the server should not be allowed to decrypt the messages. The server receives encrypted message from one client, saves it in database and then sends it to othe client as it is.

Reply With Quote
  #6  
Old February 6th, 2012, 05:45 AM
leszek31417 leszek31417 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2011
Posts: 313 leszek31417 User rank is Corporal (100 - 500 Reputation Level)leszek31417 User rank is Corporal (100 - 500 Reputation Level)leszek31417 User rank is Corporal (100 - 500 Reputation Level)leszek31417 User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 1 Week 2 Days 18 h 56 m
Reputation Power: 0
So, you certainly need a kind of a "client program".

That's my opinion.

But maybe better wait for other posts.

Reply With Quote
  #7  
Old February 6th, 2012, 06:02 AM
psyburg psyburg is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2012
Posts: 4 psyburg User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 28 m
Reputation Power: 0
Also, I have to say that the client is javascript, so the code can be viewed by everyone.

Reply With Quote
  #8  
Old February 6th, 2012, 08:01 PM
OmegaZero OmegaZero is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: May 2007
Posts: 637 OmegaZero User rank is Lieutenant General (80000 - 90000 Reputation Level)OmegaZero User rank is Lieutenant General (80000 - 90000 Reputation Level)OmegaZero User rank is Lieutenant General (80000 - 90000 Reputation Level)OmegaZero User rank is Lieutenant General (80000 - 90000 Reputation Level)OmegaZero User rank is Lieutenant General (80000 - 90000 Reputation Level)OmegaZero User rank is Lieutenant General (80000 - 90000 Reputation Level)OmegaZero User rank is Lieutenant General (80000 - 90000 Reputation Level)OmegaZero User rank is Lieutenant General (80000 - 90000 Reputation Level)OmegaZero User rank is Lieutenant General (80000 - 90000 Reputation Level)OmegaZero User rank is Lieutenant General (80000 - 90000 Reputation Level)OmegaZero User rank is Lieutenant General (80000 - 90000 Reputation Level)OmegaZero User rank is Lieutenant General (80000 - 90000 Reputation Level)OmegaZero User rank is Lieutenant General (80000 - 90000 Reputation Level)OmegaZero User rank is Lieutenant General (80000 - 90000 Reputation Level)OmegaZero User rank is Lieutenant General (80000 - 90000 Reputation Level) 
Time spent in forums: 2 Weeks 6 Days 10 h 10 m 13 sec
Reputation Power: 825
PKI & certificates might work for you: Each user generates a public/private key pair and obtains a public key certificate from a mutually trusted third party. They exchange certificates via the server, verify them, and then use these keys to encrypt & sign their messages.

You're going to need a trusted third party or a secure alternate communications path somewhere if you can't trust your server.

Of course, not trusting the server makes it kind of pointless in your case. An attacker that compromises it could simply replace the javascript code sent to the clients with his own code that saves a copy of the clear text.
__________________
sub{*{$::{$_}}{CODE}==$_[0]&& print for(%:: )}->(\&Meh);

Reply With Quote
  #9  
Old February 6th, 2012, 09:46 PM
E-Oreo's Avatar
E-Oreo E-Oreo is offline
Moderator
Click here for more information.
 
Join Date: Dec 2004
Posts: 6,459 E-Oreo User rank is General 77th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 77th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 77th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 77th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 77th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 77th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 77th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 77th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 77th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 77th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 77th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 77th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 77th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 77th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 77th Grade (Above 100000 Reputation Level)E-Oreo User rank is General 77th Grade (Above 100000 Reputation Level)  Folding Points: 945 Folding Title: Novice Folder
Time spent in forums: 1 Month 2 Weeks 4 Days 3 h 8 m 59 sec
Reputation Power: 6144
Quote:
Of course, not trusting the server makes it kind of pointless in your case. An attacker that compromises it could simply replace the javascript code sent to the clients with his own code that saves a copy of the clear text.

Quoted for emphasis because this is an exceedingly important and true point.

However, that weakness with your implementation aside, the particular security question you pose is not an uncommon one and has standard solutions.

One such solution is to generate the public and private key for each user entirely randomly and store both on the server. The public key in its plaintext form and the private key in an encrypted form. The private key is encrypted and decrypted client-side using a symmetric cipher, such as AES, with a key derived from the user's password.

In this situation, a password change is simple: retrieve the encrypted private key from the server, decrypt it using the symmetric key derived from the old password, encrypt it using the symmetric key derived from the new password, then send it back to the server for storage.

But as OmegaZero stated, not trusting the server is not an option if you use JavaScript.
__________________
How to program a basic, secure login system using PHP

Quote:
Originally Posted by Spad
Ah USB, the only rectangular connector where you have to make 3 attempts before you get it the right way around

Reply With Quote
Reply

Viewing: Dev Shed ForumsSystem AdministrationSecurity and Cryptography > Crypto Protocol Question - Crypto scheme


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.

© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 3 - Follow our Sitemap