Did anyone write a client that is using zerok authentication?? I have tried
to do it in Java, but somehow it's just not working... Here's my code for
creating zerok.. can anyone tell me if I am implementing the algorithm
correctly?
//cache digest so no need to go through calculation again
if (hash != null) return hash;
//instantiate a SHA1 hash
try {
MessageDigest md = MessageDigest.getInstance("SHA");
//hash password first
md.update(context.getPassword().getBytes());
byte[] hashA = md.digest();
//now hash hashA + zerokToken
md.reset();
md.update(hashA);
md.update(zerokToken.getBytes());
byte[] hash0 = md.digest();
byte[] hashSeq = new byte[hash0.length];
System.arraycopy(hash0, 0, hashSeq, 0, hash0.length);
//now loop the number of times specified by (zerokToken - 1)
for (int i = 0;i < (zerokSeq - 1);i++) {
md.reset();
//just start hashing
hashSeq = md.digest(hashSeq);
}
//convert to hex representation
hash = HexDec.convertBytesToHexString(hashSeq);
} catch (NoSuchAlgorithmException ex) {
//no algorithm, just return null
return "";
}
return hash;
Thanks,
Chris
PGP at ldap://certserver.pgp.com/
_______________________________________________
jdev mailing list
[EMAIL PROTECTED]
http://mailman.jabber.org/listinfo/jdev