Click here to Skip to main content
15,917,329 members
Home / Discussions / C#
   

C#

 
QuestionSecure single sign on/automatic login [modified] Pin
samcyp115-Feb-08 23:06
samcyp115-Feb-08 23:06 
Hi guys!

I need your input on how to solve a problem that we have.
Our company provides a web-service, a SaaS.
Our idea is to create a destop appilication that can communicate with the web service using https.
I have written a .net app in C#, and I need ideas on how I can login a user without the user needing to type his username and password each time.
The idea is that the user inputs his username and password once and then checks the checkbox to automatically login. Now the user doesn't need to input his login details each time the program restarts. My criteria is that the client should never store the password (clear-text or encrypted) on the local machine.

This is my idea for a solution.
User input the username and password on the desktop-client
The client sends the login details to the webserver, over ssl.
The server verifies the login details and sends back a challenge to the client, if the username and password was correct.
The client then computes a static value using DAPI. This is how i do it:

Code Snippet

private static RSA GetKey(DataProtectionScope scope)
{
switch (scope)
{
case DataProtectionScope.CurrentUser:
if (user == null)
{
CspParameters csp = new CspParameters();
csp.KeyContainerName = "DAPI";
user = new RSACryptoServiceProvider(1536, csp);
}
return user;
default:
throw new CryptographicException("Invalid scope.");
}
}

RSA rsaKey = GetKey(DataProtectionScope.CurrentUser);
RSAParameters keyParam = rsaKey.ExportParameters(true);


Then I use keyParam.P, which is the private key as the static value.
And this static value is dependent on the current user that is loged in to the OS.
I use the static value and the challenged recieved from the server to compute a hash value, H(keyParam.P, challenge).
The client send this value back to the server, and the server will use this hash value in future authentication.

So from now on, the client needs to compute this hash value on runtime, each time he wants to access the webservice.

I think this is strong enough for authentication. But the only problem I see with this solution is that the server has no idea what application is communicating with it. I want from the server only allow application signed or certified by us to contact the server. Because, the problem I see is that, an attacker can create an imitation of my destop client and fetch information from the server, if the user chooses to use "automatic login" feature.

I hope you guys understand my problem. Any replies will be deeply appreciated!

Thank,
/SC

modified on Wednesday, February 06, 2008 5:50:18 AM

GeneralMDI Problem Pin
murali_utr5-Feb-08 22:43
murali_utr5-Feb-08 22:43 
GeneralRe: MDI Problem Pin
DaveyM696-Feb-08 0:13
professionalDaveyM696-Feb-08 0:13 
Generalinput box in c# Pin
sumit70345-Feb-08 22:35
sumit70345-Feb-08 22:35 
GeneralRe: input box in c# Pin
GuyThiebaut5-Feb-08 23:54
professionalGuyThiebaut5-Feb-08 23:54 
AnswerRe: input box in c# Pin
suchi6-Feb-08 1:32
suchi6-Feb-08 1:32 
GeneralRe: input box in c# Pin
Vasudevan Deepak Kumar6-Feb-08 2:44
Vasudevan Deepak Kumar6-Feb-08 2:44 
QuestionRe: input box in c# Pin
suchi6-Feb-08 17:40
suchi6-Feb-08 17:40 
QuestionHow to write a JAVA program to mesure ping delay..? Pin
sacr835-Feb-08 22:25
sacr835-Feb-08 22:25 
AnswerRe: How to write a JAVA program to mesure ping delay..? Pin
Malcolm Smart5-Feb-08 23:27
Malcolm Smart5-Feb-08 23:27 
GeneralAuto maximize state of MDI children Pin
Dewald5-Feb-08 22:09
Dewald5-Feb-08 22:09 
GeneralRe: Auto maximize state of MDI children Pin
DaveyM696-Feb-08 1:03
professionalDaveyM696-Feb-08 1:03 
GeneralWriting custom rules for fxcop 1.35 Pin
Praveen_S5-Feb-08 21:48
Praveen_S5-Feb-08 21:48 
GeneralRe: Writing custom rules for fxcop 1.35 Pin
John_Adams5-Feb-08 22:34
John_Adams5-Feb-08 22:34 
GeneralRemovePreviousVersions doesn’t work in VS 2008 Pin
anderslundsgard5-Feb-08 21:43
anderslundsgard5-Feb-08 21:43 
Generalexcel addins Pin
arkiboys5-Feb-08 21:30
arkiboys5-Feb-08 21:30 
Questionhow can i open outlook and send mail usin c# code ? Pin
E_Gold5-Feb-08 21:21
E_Gold5-Feb-08 21:21 
AnswerRe: how can i open outlook and send mail usin c# code ? Pin
Vikram A Punathambekar5-Feb-08 21:26
Vikram A Punathambekar5-Feb-08 21:26 
AnswerRe: how can i open outlook and send mail usin c# code ? Pin
Justin Perez6-Feb-08 3:02
Justin Perez6-Feb-08 3:02 
Generaldisabling particular text in textbox control Pin
DKalepu5-Feb-08 21:07
DKalepu5-Feb-08 21:07 
GeneralRe: disabling particular text in textbox control Pin
Vikram A Punathambekar5-Feb-08 21:24
Vikram A Punathambekar5-Feb-08 21:24 
GeneralRe: disabling particular text in textbox control [modified] Pin
DaveyM696-Feb-08 0:33
professionalDaveyM696-Feb-08 0:33 
GeneralProject: Some random questions Pin
kingletas5-Feb-08 20:43
kingletas5-Feb-08 20:43 
GeneralWindows Authentication Help Needed Pin
Brendan Vogt5-Feb-08 20:43
Brendan Vogt5-Feb-08 20:43 
QuestionDeclaring and Passing value to public variable Pin
klaydze5-Feb-08 19:26
klaydze5-Feb-08 19:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.