src/share/classes/com/sun/security/sasl/CramMD5Client.java

Print this page




  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package com.sun.security.sasl;
  27 
  28 import javax.security.sasl.*;
  29 import java.security.NoSuchAlgorithmException;
  30 
  31 import java.util.logging.Logger;
  32 import java.util.logging.Level;
  33 
  34 /**
  35   * Implements the CRAM-MD5 SASL client-side mechanism.
  36   * (<A HREF="ftp://ftp.isi.edu/in-notes/rfc2195.txt">RFC 2195</A>).
  37   * CRAM-MD5 has no initial response. It receives bytes from
  38   * the server as a challenge, which it hashes by using MD5 and the password.
  39   * It concatenates the authentication ID with this result and returns it
  40   * as the response to the challenge. At that point, the exchange is complete.
  41   *
  42   * @author Vincent Ryan
  43   * @author Rosanna Lee
  44   */
  45 final class CramMD5Client extends CramMD5Base implements SaslClient {
  46     private String username;
  47 
  48     /**
  49      * Creates a SASL mechanism with client credentials that it needs
  50      * to participate in CRAM-MD5 authentication exchange with the server.
  51      *
  52      * @param authID A  non-null string representing the principal
  53      * being authenticated.
  54      *
  55      * @param pw A non-null String or byte[]
  56      * containing the password. If it is an array, it is first cloned.




  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package com.sun.security.sasl;
  27 
  28 import javax.security.sasl.*;
  29 import java.security.NoSuchAlgorithmException;
  30 
  31 import java.util.logging.Logger;
  32 import java.util.logging.Level;
  33 
  34 /**
  35   * Implements the CRAM-MD5 SASL client-side mechanism.
  36   * (<A HREF="http://www.ietf.org/rfc/rfc2195.txt">RFC 2195</A>).
  37   * CRAM-MD5 has no initial response. It receives bytes from
  38   * the server as a challenge, which it hashes by using MD5 and the password.
  39   * It concatenates the authentication ID with this result and returns it
  40   * as the response to the challenge. At that point, the exchange is complete.
  41   *
  42   * @author Vincent Ryan
  43   * @author Rosanna Lee
  44   */
  45 final class CramMD5Client extends CramMD5Base implements SaslClient {
  46     private String username;
  47 
  48     /**
  49      * Creates a SASL mechanism with client credentials that it needs
  50      * to participate in CRAM-MD5 authentication exchange with the server.
  51      *
  52      * @param authID A  non-null string representing the principal
  53      * being authenticated.
  54      *
  55      * @param pw A non-null String or byte[]
  56      * containing the password. If it is an array, it is first cloned.