Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
We have one application it has in Java .

they have followed to validate user ,For Encryption Password validating like this :
Java
public String digest(String str2Digest)
{
    FixedStringSaltGenerator fixedStringSaltGenerator = new FixedStringSaltGenerator();
    fixedStringSaltGenerator.setSalt(str2Digest+"XXXX-XX");
    StandardStringDigester digester = new StandardStringDigester();
    digester.setAlgorithm("SHA-512");
    digester.setIterations(10024);
    digester.setSaltGenerator(fixedStringSaltGenerator);
    return digester.digest(str2Digest);
}

now i have created a Service in .net ,my service also need same validation in .net.

Can you suggest best way for the above code in .net

[Edit member="Tadit"]
Added pre tags.
[/Edit]
Posted
v2
Comments
Rocker-Star 3-Sep-14 4:37am    
Personally, i would not be interested in creating a duplicate validate method, if you have an API from the 3rd party vendor you could use that.
ZurdoDev 3-Sep-14 8:24am    
Just google SHA-512 c# examples.

1 solution

Have a look at http://brianreiter.org/2011/05/19/secure-password-hashing-in-c/[^], which does SHA-512 hashing with iterations and salt.
 
Share this answer
 
Comments
venuchary 4-Sep-14 2:32am    
Yes If it is Two ends has .Net not a problem but here situation is Encrypting done in java . In .Net I need to do my input pwd is Encrypting or Decrypting the existing pwd in database.
kbrandwijk 4-Sep-14 4:53am    
I don't understand your problem. It doesn't matter if the existing password was encrypted in Java. If you use the same algorithm in .NET, the same strength, the same salt, the same number of iterations, then you should also end up with the same password, and you can also decrypt it.
venuchary 10-Sep-14 7:16am    
@kbrandwijk :- i too feel it was Simple, but real scenario it generating different password.
used same SHA-512 algorithm , same strength ,same no of iterations .
i followed this link :
http://www.programminginterviews.info/2012/05/how-to-store-user-passwords-using.html

for ex: i have given to "abc " is Pwd it encryption code is
mlzwReJaNT8Y6ep+3x/+iQVc+IhYom3+i6CLM85GjPYD6f127Le8px3rVj/qFiCg9XBZcTSGN0QZ57sMB6tbbg==

So u would try in .Net

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900