United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: 7043847 NTML impl of SaslServer throws UnsupportedOperationException from (un)wrap method
7043847 : NTML impl of SaslServer throws UnsupportedOperationException from (un)wrap method

Details
Type:
Bug
Submit Date:
2011-05-11
Status:
Closed
Updated Date:
2012-09-05
Project Name:
JDK
Resolved Date:
2012-09-05
Component:
security-libs
OS:
generic
Sub-Component:
java.security
CPU:
generic
Priority:
P2
Resolution:
Fixed
Affected Versions:
7
Fixed Versions:
8

Related Reports
Backport:

Sub Tasks

Description
Platform: Windows, Solaris
JDK: Oracle JDK7
(not reproducible on JDK6 as NTLMServer is not present in Sun's JDK6)

The com.sun.security.sasl.ntlm.NTLMServer implementaiton of methods

 http://download.java.net/jdk7/docs/api/javax/security/sasl/SaslServer.html#wrap%28byte[],%20int,%20int%29
 http://download.java.net/jdk7/docs/api/javax/security/sasl/SaslServer.html#unwrap%28byte[],%20int,%20int%29

Throw java.lang.UnsupportedOperationException: Not supported yet.
in simple situation when IllegalStateException is expected to be thrwon 
when the authentication exchange has not completed.

Please see the following code sample:

--------------------------------------------------------------------------------------------
package sasl;

import javax.security.auth.callback.Callback;
import javax.security.auth.callback.CallbackHandler;
import javax.security.auth.callback.UnsupportedCallbackException;
import javax.security.sasl.Sasl;
import javax.security.sasl.SaslException;
import javax.security.sasl.SaslServer;
import javax.security.sasl.SaslServerFactory;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;

public class WrapUnwrap {

    public static void main(String[] args) throws SaslException {
        ArrayList<SaslServerFactory> list = Collections.list(Sasl.getSaslServerFactories());
        for (SaslServerFactory saslServerFactory : list) {
            System.err.println("saslServerFactory = " + saslServerFactory);
            String[] mechanismNames = saslServerFactory.getMechanismNames(null);
            if (mechanismNames.length == 1 && "NTLM".equals(mechanismNames[0])) {
                SaslServer saslServer =
                        saslServerFactory.createSaslServer("NTLM", "ldap", "abc", null, new CallbackHandler() {
                            @Override
                            public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {  }
                        });
                System.err.println("saslServer = " + saslServer);
                System.err.println("saslServer.isComplete() = " + saslServer.isComplete());
                // IllegalStateException is expected here
                saslServer.wrap(new byte[0], 0, 0);
//                saslServer.unwrap(new byte[0], 0, 0);
            }
        }
    }
}
--------------------------------------------------------------------------------------------

The output will look like:


saslServerFactory = com.sun.security.sasl.digest.FactoryImpl@1cb3087
saslServerFactory = com.sun.security.sasl.gsskerb.FactoryImpl@14c0761
saslServerFactory = com.sun.security.sasl.ServerFactoryImpl@4134e0
saslServerFactory = com.sun.security.sasl.ntlm.FactoryImpl@1f08b14
saslServer = com.sun.security.sasl.ntlm.NTLMServer@5797cf
saslServer.isComplete() = false
Exception in thread "main" java.lang.UnsupportedOperationException: Not supported yet.
	at com.sun.security.sasl.ntlm.NTLMServer.wrap(NTLMServer.java:208)
	at sasl.WrapUnwrap.main(WrapUnwrap.java:31)

                                    

Comments
EVALUATION

http://hg.openjdk.java.net/jdk8/tl/jdk/rev/55952703809f
                                     
2011-08-19



Hardware and Software, Engineered to Work Together