Package com.sun.mail.auth
Class Ntlm
- java.lang.Object
-
- com.sun.mail.auth.Ntlm
-
public class Ntlm extends java.lang.Object
NTLMAuthentication:
-
-
Field Summary
Fields Modifier and Type Field Description private javax.crypto.Cipher
cipher
private javax.crypto.SecretKeyFactory
fac
private static char[]
hex
private java.lang.String
hostname
private MailLogger
logger
private MD4
md4
private java.lang.String
ntdomain
private java.lang.String
password
private byte[]
type1
private byte[]
type3
private java.lang.String
username
-
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 void
copybytes(byte[] dest, int destpos, java.lang.String src, java.lang.String enc)
java.lang.String
generateType1Msg(int flags)
java.lang.String
generateType3Msg(java.lang.String challenge)
private void
init0()
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.String
toHex(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)
-
-