< prev index next >

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

Print this page




  86     }
  87 
  88     /**
  89       * Wraps the outgoing buffer. CRAM-MD5 supports no security layer.
  90       *
  91       * @throws SaslException If attempt to use this method.
  92       */
  93     public byte[] wrap(byte[] outgoing, int offset, int len) throws SaslException {
  94         if (completed) {
  95             throw new IllegalStateException(
  96                 "CRAM-MD5 supports neither integrity nor privacy");
  97         } else {
  98             throw new IllegalStateException(
  99                 "CRAM-MD5 authentication not completed");
 100         }
 101     }
 102 
 103     /**
 104      * Retrieves the negotiated property.
 105      * This method can be called only after the authentication exchange has
 106      * completed (i.e., when <tt>isComplete()</tt> returns true); otherwise, a
 107      * <tt>SaslException</tt> is thrown.
 108      *
 109      * @return value of property; only QOP is applicable to CRAM-MD5.
 110      * @exception IllegalStateException if this authentication exchange has not completed
 111      */
 112     public Object getNegotiatedProperty(String propName) {
 113         if (completed) {
 114             if (propName.equals(Sasl.QOP)) {
 115                 return "auth";
 116             } else {
 117                 return null;
 118             }
 119         } else {
 120             throw new IllegalStateException(
 121                 "CRAM-MD5 authentication not completed");
 122         }
 123     }
 124 
 125     public void dispose() throws SaslException {
 126         clearPassword();
 127     }




  86     }
  87 
  88     /**
  89       * Wraps the outgoing buffer. CRAM-MD5 supports no security layer.
  90       *
  91       * @throws SaslException If attempt to use this method.
  92       */
  93     public byte[] wrap(byte[] outgoing, int offset, int len) throws SaslException {
  94         if (completed) {
  95             throw new IllegalStateException(
  96                 "CRAM-MD5 supports neither integrity nor privacy");
  97         } else {
  98             throw new IllegalStateException(
  99                 "CRAM-MD5 authentication not completed");
 100         }
 101     }
 102 
 103     /**
 104      * Retrieves the negotiated property.
 105      * This method can be called only after the authentication exchange has
 106      * completed (i.e., when {@code isComplete()} returns true); otherwise, a
 107      * {@code SaslException} is thrown.
 108      *
 109      * @return value of property; only QOP is applicable to CRAM-MD5.
 110      * @exception IllegalStateException if this authentication exchange has not completed
 111      */
 112     public Object getNegotiatedProperty(String propName) {
 113         if (completed) {
 114             if (propName.equals(Sasl.QOP)) {
 115                 return "auth";
 116             } else {
 117                 return null;
 118             }
 119         } else {
 120             throw new IllegalStateException(
 121                 "CRAM-MD5 authentication not completed");
 122         }
 123     }
 124 
 125     public void dispose() throws SaslException {
 126         clearPassword();
 127     }


< prev index next >