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

public Class DigestMD5

extends Object
Class Inheritance
Imports
java.io.*, java.util.*, java.util.logging.Level, java.security.*, java.nio.charset.StandardCharsets, com.sun.mail.util.MailLogger, .ASCIIUtility, .BASE64EncoderStream, .BASE64DecoderStream

DIGEST-MD5 authentication support.
Authors
Dean Gibson, Bill Shannon

Field Summary

Modifier and TypeField and Description
private String
private static char[]
private MailLogger
private MessageDigest
private String

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public byte[]

Returns:

byte array with client's response
authClient
(String
the host name
host
,
String
the user name
user
,
String
the user's password
passwd
,
String
the security realm
realm
,
String
the challenge from the server
serverChallenge
)

Return client's authentication response to server's challenge.

public boolean

Returns:

true if server is authenticated
authServer
(String
the response that was received from the server
serverResponse
)

Allow the client to authenticate the server based on its response.

private static String
toHex(byte[] bytes)

Convert a byte array to a string of hex digits representing the bytes.

private Map<String, String>

Returns:

Map containing key/value pairs from server
tokenize
(String serverResponse)

Tokenize a response from the server.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

clientResponseback to summary
private String clientResponse
digitsback to summary
private static char[] digits
loggerback to summary
private MailLogger logger
md5back to summary
private MessageDigest md5
uriback to summary
private String uri

Constructor Detail

DigestMD5back to summary
public DigestMD5(MailLogger logger)

Method Detail

authClientback to summary
public byte[] authClient(String host, String user, String passwd, String realm, String serverChallenge) throws IOException

Return client's authentication response to server's challenge.

Parameters
host:String

the host name

user:String

the user name

passwd:String

the user's password

realm:String

the security realm

serverChallenge:String

the challenge from the server

Returns:byte[]

byte array with client's response

Exceptions
IOException:
for I/O errors
authServerback to summary
public boolean authServer(String serverResponse) throws IOException

Allow the client to authenticate the server based on its response.

Parameters
serverResponse:String

the response that was received from the server

Returns:boolean

true if server is authenticated

Exceptions
IOException:
for character conversion failures
toHexback to summary
private static String toHex(byte[] bytes)

Convert a byte array to a string of hex digits representing the bytes.

tokenizeback to summary
private Map<String, String> tokenize(String serverResponse) throws IOException

Tokenize a response from the server.

Returns:Map<String, String>

Map containing key/value pairs from server

Annotations
@SuppressWarnings:fallthrough