env.put(Context.SECURITY_AUTHENTICATION, "simple");
env.put(Context.SECURITY_PRINCIPAL, bind_dn);
if (bind_pw.startsWith(Crypto.prefix())) {
Crypto c = new Crypto();
try {
bind_pw = c.decrypt(bind_pw);
} catch (CryptoException ex) {
throw new NamingException(ex.toString());
}
}
env.put(Context.SECURITY_CREDENTIALS, bind_pw);