Thank you for the reply... Not working in PHP, I thought I should take a look at the James code to try and understand how it deals with passwords. So, for the Java people out there, and, if I have understood correctly, this is the code that James uses to encrypt the password:
private static String digestString(String pass, String algorithm) throws NoSuchAlgorithmException { MessageDigest md; ByteArrayOutputStream bos; try { md = MessageDigest.getInstance(algorithm); byte[] digest = md.digest(pass.getBytes("iso-8859-1")); bos = new ByteArrayOutputStream(); OutputStream encodedStream = MimeUtility.encode(bos, "base64"); encodedStream.write(digest); return bos.toString("iso-8859-1"); } catch (IOException ioe) { throw new RuntimeException("Fatal error: " + ioe); } catch (MessagingException me) { throw new RuntimeException("Fatal error: " + me); } } And, I think the algorithm is: SHA. For example: System.out.println( digestString("5789200", "SHA") ); This will be extremely useful in our environment. Thanks. -----Original Message----- From: Stefano Bagnara [mailto:[EMAIL PROTECTED] Sent: 03 August 2007 01:10 PM To: James Users List Subject: Re: database driven user list Users are not currently cached, so you can simply add rows to the users db and they will be ready to use by JAMES Server. The only "problem" is that you have to encrypt the password with the same algorithm used by JAMES. --- Daniel Perry wrote ---- This is an SHA hash but not in the format you'd expect. It's a base64 encoded rather than hex (reduces the size). Its then trimmed of padding. Some php code to do this is as follows: function hashPassword($in){ $pwd=base64_encode(hex2bin(sha1($in))); $pwd=substr($pwd,0,strlen($pwd)-4); return $pwd; } function hex2bin($source) { $strlen = strlen($source); for ($i=0;$i<strlen($source);$i=$i+2) { $bin .= chr(hexdec(substr ($source, $i,2))); } return $bin; } -------------------------------- Stefano renen ha scritto: > Hello, > > Is it possible to have a DB based user list? In other words, can I configure > the James Server so that adding a row to a users table in the database > effectively creates the user in the same way that one would normally telnet > into port 4555? > > There are some references to this kind of thing in mails going back to 2004 > - but nothing concrete. The JDBCVirtualTable concept still seems to require > that an underlying user account needs to be created. > > Thank you for your input. > > Renen. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]