Top Description Fields Constructors Methods
com.sun.mail.auth

public Class Ntlm

extends Object
Class Inheritance
Imports
java.io.IOException, .UnsupportedEncodingException, .PrintStream, java.security.GeneralSecurityException, .NoSuchAlgorithmException, java.util.Locale, java.util.logging.Level, javax.crypto.Cipher, .NoSuchPaddingException, .SecretKey, .SecretKeyFactory, javax.crypto.spec.DESKeySpec, com.sun.mail.util.BASE64DecoderStream, .BASE64EncoderStream, .MailLogger

NTLMAuthentication:
Authors
Michael McMahon, Bill Shannon (adapted for JavaMail)

Field Summary

Modifier and TypeField and Description
private Cipher
private SecretKeyFactory
private static char[]
private String
private MailLogger
private MD4
private String
private String
private byte[]
private byte[]
private String

Constructor Summary

AccessConstructor and Description
public
Ntlm(String
the NT domain
ntdomain
,
String
the host name
hostname
,
String
the user name
username
,
String
the password
password
,
MailLogger
the MailLogger
logger
)

Create an NTLM authenticator.

Method Summary

Modifier and TypeMethod and Description
private byte[]
private byte[]
private byte[]
calcResponse(byte[] key, byte[] text)

private void
copybytes(byte[] dest, int destpos, String src, String enc)

public String
generateType1Msg(int flags)

public String
private void
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 String
toHex(byte[] b)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

cipherback to summary
private Cipher cipher
facback to summary
private SecretKeyFactory fac
hexback to summary
private static char[] hex
hostnameback to summary
private String hostname
loggerback to summary
private MailLogger logger
md4back to summary
private MD4 md4
ntdomainback to summary
private String ntdomain
passwordback to summary
private String password
type1back to summary
private byte[] type1
type3back to summary
private byte[] type3
usernameback to summary
private String username

Constructor Detail

Ntlmback to summary
public Ntlm(String ntdomain, String hostname, String username, 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:String

the NT domain

hostname:String

the host name

username:String

the user name

password:String

the password

logger:MailLogger

the MailLogger

Method Detail

calcLMHashback to summary
private byte[] calcLMHash() throws GeneralSecurityException
calcNTHashback to summary
private byte[] calcNTHash() throws GeneralSecurityException
calcResponseback to summary
private byte[] calcResponse(byte[] key, byte[] text) throws GeneralSecurityException
copybytesback to summary
private void copybytes(byte[] dest, int destpos, String src, String enc)
generateType1Msgback to summary
public String generateType1Msg(int flags)
generateType3Msgback to summary
public String generateType3Msg(String challenge)
init0back to summary
private void init0()
makeDesKeyback to summary
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.

toHexback to summary
private static String toHex(byte[] b)