Equivalent of PHP's crypt function in Java

后端 未结 7 2224
青春惊慌失措
青春惊慌失措 2020-12-16 14:24

I am migrating my PHP code to Google App Engine - Java.
So I need an equivalent of PHP\'s crypt function in Java,
since I have stored all the passwords of registered

7条回答
  •  醉酒成梦
    2020-12-16 14:54

    You need to take a look at the java.security classes (what used to tbe the JCE):

    In there you'll find everything you need to do what you want (depending on which algorithm you need).

    http://download.oracle.com/docs/cd/E17409_01/javase/6/docs/api/java/security/package-summary.html

    e.g. MessageDigest for MD5/SHA etc:

    http://download.oracle.com/docs/cd/E17409_01/javase/6/docs/api/java/security/MessageDigest.html

    Check these against the Google App Engine whitelist here, I'm not sure what's supported and what isn't.

    http://code.google.com/appengine/docs/java/jrewhitelist.html

    The java.security stuff can be a bit of a pain to work with sometimes, you may alternatively want to use Jasypt - which is a more simplified API that works with any JCE:

    http://www.jasypt.org/

提交回复
热议问题