2362N/A * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 0N/A * published by the Free Software Foundation. Oracle designates this 0N/A * particular file as subject to the "Classpath" exception as provided 0N/A * by Oracle in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 0N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 0N/A * or visit www.oracle.com if you need additional information or have any 4378N/A * This class implements the LDAPv3 Extended Request for StartTLS as 0N/A * Access Protocol (v3): Extension for Transport Layer Security</a> 0N/A * The object identifier for StartTLS is 1.3.6.1.4.1.1466.20037 0N/A * and no extended request value is defined. 0N/A * <tt>StartTlsRequest</tt>/<tt>StartTlsResponse</tt> are used to establish 0N/A * a TLS connection over the existing LDAP connection associated with 0N/A * the JNDI context on which <tt>extendedOperation()</tt> is invoked. 0N/A * Typically, a JNDI program uses these classes as follows. 0N/A * import javax.naming.ldap.*; 0N/A * // Open an LDAP association 0N/A * LdapContext ctx = new InitialLdapContext(); 0N/A * // Perform a StartTLS extended operation 0N/A * StartTlsResponse tls = 0N/A * (StartTlsResponse) ctx.extendedOperation(new StartTlsRequest()); 0N/A * // Open a TLS connection (over the existing LDAP association) and get details 0N/A * // of the negotiated TLS session: cipher suite, peer certificate, etc. 0N/A * SSLSession session = tls.negotiate(); 0N/A * // ... use ctx to perform protected LDAP operations 0N/A * // Close the TLS connection (revert back to the underlying LDAP association) 0N/A * // ... use ctx to perform unprotected LDAP operations 0N/A * // Close the LDAP association 0N/A * </pre></blockquote> 0N/A * @see StartTlsResponse 0N/A * @author Vincent Ryan 0N/A * The StartTLS extended request's assigned object identifier 0N/A * is 1.3.6.1.4.1.1466.20037. 0N/A * Constructs a StartTLS extended request. 0N/A // ExtendedRequest methods 0N/A * Retrieves the StartTLS request's object identifier string. 0N/A * @return The object identifier string, "1.3.6.1.4.1.1466.20037". 0N/A * Retrieves the StartTLS request's ASN.1 BER encoded value. 0N/A * Since the request has no defined value, null is always 0N/A * @return The null value. 0N/A * Creates an extended response object that corresponds to the 0N/A * LDAP StartTLS extended request. 0N/A * The result must be a concrete subclass of StartTlsResponse 0N/A * and must have a public zero-argument constructor. 0N/A * This method locates the implementation class by locating 0N/A * configuration files that have the name: 0N/A * </tt></blockquote> 0N/A * The configuration files and their corresponding implementation classes must 0N/A * be accessible to the calling thread's context class loader. 0N/A * Each configuration file should contain a list of fully-qualified class 0N/A * names, one per line. Space and tab characters surrounding each name, as 0N/A * well as blank lines, are ignored. The comment character is <tt>'#'</tt> 0N/A * (<tt>0x23</tt>); on each line all characters following the first comment 0N/A * character are ignored. The file must be encoded in UTF-8. 0N/A * This method will return an instance of the first implementation 0N/A * class that it is able to load and instantiate successfully from 0N/A * the list of class names collected from the configuration files. 0N/A * This method uses the calling thread's context classloader to find the 0N/A * configuration files and to load the implementation class. 0N/A * If no class can be found in this way, this method will use 0N/A * an implementation-specific way to locate an implementation. 0N/A * If none is found, a NamingException is thrown. 0N/A * @param id The object identifier of the extended response. 0N/A * Its value must be "1.3.6.1.4.1.1466.20037" or null. 0N/A * Both values are equivalent. 0N/A * @param berValue The possibly null ASN.1 BER encoded value of the 0N/A * extended response. This is the raw BER bytes 0N/A * including the tag and length of the response value. 0N/A * It does not include the response OID. 0N/A * Its value is ignored because a Start TLS response 0N/A * is not expected to contain any response value. 0N/A * @param offset The starting position in berValue of the bytes to use. 0N/A * Its value is ignored because a Start TLS response 0N/A * is not expected to contain any response value. 0N/A * @param length The number of bytes in berValue to use. 0N/A * Its value is ignored because a Start TLS response 0N/A * is not expected to contain any response value. 0N/A * @return The StartTLS extended response object. 0N/A * @exception NamingException If a naming exception was encountered 0N/A * while creating the StartTLS extended response object. 0N/A // Confirm that the object identifier is correct 0N/A "Start TLS received the following response instead of " +
0N/A "com.sun.jndi.ldap.ext.StartTlsResponseImpl");
0N/A * Wrap an exception, thrown while attempting to load the StartTlsResponse 0N/A * class, in a configuration exception. 0N/A "Cannot load implementation of javax.naming.ldap.StartTlsResponse");
0N/A * Acquire the class loader associated with this thread.