|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sun.slamd.scripting.mail.CRAMMD5Handler
This class provides a set of methods that can be used in the process of authenticating to a server using CRAM-MD5 as defined in RFC 2195, which itself is based on HMAC as defined in RFC 2104.
| Field Summary | |
static int |
BLOCK_LENGTH
The block length in characters used in generating an HMAC-MD5 digest. |
static byte |
IPAD_BYTE
The inner pad byte, which will be XORed with the shared secret for the first digest. |
static int |
MD5_DIGEST_LENGTH
The number of bytes contained in an MD5 digest. |
static byte |
OPAD_BYTE
The outer pad byte, which will be XORed with the shared secret for the second digest. |
| Constructor Summary | |
CRAMMD5Handler()
Creates a new instance of this CRAM-MD5 handler. |
|
| Method Summary | |
java.lang.String |
generateCRAMMD5Response(java.lang.String username,
java.lang.String password,
java.lang.String challenge)
Generates the CRAM-MD5 response that should be used for the provided information. |
byte[] |
generateHMACMD5(byte[] data,
byte[] key)
Generates an HMAC-MD5 response based on the provided key and data. |
static void |
main(java.lang.String[] args)
Provides a means of testing this CRAM-MD5 handler by generating a CRAM-MD5 response for the given information. |
static void |
writeToHexString(byte[] byteArray,
java.lang.StringBuffer buffer)
Writes a hexadecimal representation of the contents of the provided byte array into the given string buffer. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final int BLOCK_LENGTH
public static final int MD5_DIGEST_LENGTH
public static final byte IPAD_BYTE
public static final byte OPAD_BYTE
| Constructor Detail |
public CRAMMD5Handler()
throws java.security.NoSuchAlgorithmException
java.security.NoSuchAlgorithmException - If a problem occurs while trying to
initialize the MD5 digest handler.| Method Detail |
public static void main(java.lang.String[] args)
args - The command line arguments provided to this program. There
must be exactly three arguments, and they must be the
username, password, and challenge (in that order).
public java.lang.String generateCRAMMD5Response(java.lang.String username,
java.lang.String password,
java.lang.String challenge)
username - The username to use in the authentication process.password - The password to use in the authentication process.challenge - The challenge provided by the server to which
authentication is to be performed.
public byte[] generateHMACMD5(byte[] data,
byte[] key)
data - The plain-text data to include in the response.key - The secret key to use in the response.
public static void writeToHexString(byte[] byteArray,
java.lang.StringBuffer buffer)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||