Package com.sun.mail.auth
Class Ntlm
- java.lang.Object
-
- com.sun.mail.auth.Ntlm
-
public class Ntlm extends java.lang.ObjectNTLMAuthentication:
-
-
Field Summary
Fields Modifier and Type Field Description private javax.crypto.Ciphercipherprivate javax.crypto.SecretKeyFactoryfacprivate static char[]hexprivate java.lang.Stringhostnameprivate MailLoggerloggerprivate MD4md4private java.lang.Stringntdomainprivate java.lang.Stringpasswordprivate byte[]type1private byte[]type3private java.lang.Stringusername
-
Constructor Summary
Constructors Constructor Description Ntlm(java.lang.String ntdomain, java.lang.String hostname, java.lang.String username, java.lang.String password, MailLogger logger)Create an NTLM authenticator.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private byte[]calcLMHash()private byte[]calcNTHash()private byte[]calcResponse(byte[] key, byte[] text)private voidcopybytes(byte[] dest, int destpos, java.lang.String src, java.lang.String enc)java.lang.StringgenerateType1Msg(int flags)java.lang.StringgenerateType3Msg(java.lang.String challenge)private voidinit0()private byte[]makeDesKey(byte[] input, int off)Convert a 7 byte array to an 8 byte array (for a des key with parity).private static java.lang.StringtoHex(byte[] b)
-
-
-
Field Detail
-
type1
private byte[] type1
-
type3
private byte[] type3
-
fac
private javax.crypto.SecretKeyFactory fac
-
cipher
private javax.crypto.Cipher cipher
-
md4
private MD4 md4
-
hostname
private java.lang.String hostname
-
ntdomain
private java.lang.String ntdomain
-
username
private java.lang.String username
-
password
private java.lang.String password
-
logger
private MailLogger logger
-
hex
private static char[] hex
-
-
Constructor Detail
-
Ntlm
public Ntlm(java.lang.String ntdomain, java.lang.String hostname, java.lang.String username, java.lang.String password, MailLogger logger)Create an NTLM authenticator. Username may be specified as domain\\username in the Authenticator. If this notation is not used, then the domain will be taken from the ntdomain parameter.- Parameters:
ntdomain- the NT domainhostname- the host nameusername- the user namepassword- the passwordlogger- the MailLogger
-
-
Method Detail
-
init0
private void init0()
-
copybytes
private void copybytes(byte[] dest, int destpos, java.lang.String src, java.lang.String enc)
-
generateType1Msg
public java.lang.String generateType1Msg(int flags)
-
makeDesKey
private byte[] makeDesKey(byte[] input, int off)Convert a 7 byte array to an 8 byte array (for a des key with parity). Input starts at offset off.
-
calcLMHash
private byte[] calcLMHash() throws java.security.GeneralSecurityException- Throws:
java.security.GeneralSecurityException
-
calcNTHash
private byte[] calcNTHash() throws java.security.GeneralSecurityException- Throws:
java.security.GeneralSecurityException
-
calcResponse
private byte[] calcResponse(byte[] key, byte[] text) throws java.security.GeneralSecurityException- Throws:
java.security.GeneralSecurityException
-
generateType3Msg
public java.lang.String generateType3Msg(java.lang.String challenge)
-
toHex
private static java.lang.String toHex(byte[] b)
-
-