JavaTM 2 Platform
Standard Ed. 6

javax.naming.ldap
类 StartTlsRequest

java.lang.Object
  继承者 javax.naming.ldap.StartTlsRequest
所有已实现的接口:
Serializable, ExtendedRequest

public class StartTlsRequest
extends Object
implements ExtendedRequest

此类实现在 Lightweight Directory Access Protocol (v3): Extension for Transport Layer Security 中定义的 StartTLS 的 LDAPv3 扩展请求。 StartTLS 的对象标识符为 1.3.6.1.4.1.1466.20037,没有定义任何扩展请求值。

使用 StartTlsRequest/StartTlsResponse 在与 JNDI 上下文(对该上下文调用 extendedOperation())关联的现有 LDAP 连接上建立 TLS 连接。通常,JNDI 程序使用以下这些类。

 import javax.naming.ldap.*;

 // Open an LDAP association
 LdapContext ctx = new InitialLdapContext();

 // Perform a StartTLS extended operation
 StartTlsResponse tls =
     (StartTlsResponse) ctx.extendedOperation(new StartTlsRequest());

 // Open a TLS connection (over the existing LDAP association) and get details
 // of the negotiated TLS session: cipher suite, peer certificate, etc.
 SSLSession session = tls.negotiate();

 // ... use ctx to perform protected LDAP operations

 // Close the TLS connection (revert back to the underlying LDAP association)
 tls.close();

 // ... use ctx to perform unprotected LDAP operations

 // Close the LDAP association
 ctx.close;
 

从以下版本开始:
1.4
另请参见:
StartTlsResponse, 序列化表格

字段摘要
static String OID
          StartTLS 扩展请求的分配对象标识符为 1.3.6.1.4.1.1466.20037。
 
构造方法摘要
StartTlsRequest()
          构造 StartTLS 扩展请求。
 
方法摘要
 ExtendedResponse createExtendedResponse(String id, byte[] berValue, int offset, int length)
          创建与 LDAP StartTLS 扩展请求相对应的扩展响应对象。
 byte[] getEncodedValue()
          检索 StartTLS 请求的 ASN.1 BER 编码值。
 String getID()
          检索 StartTLS 请求的对象标识符字符串。
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

字段详细信息

OID

public static final String OID
StartTLS 扩展请求的分配对象标识符为 1.3.6.1.4.1.1466.20037。

另请参见:
常量字段值
构造方法详细信息

StartTlsRequest

public StartTlsRequest()
构造 StartTLS 扩展请求。

方法详细信息

getID

public String getID()
检索 StartTLS 请求的对象标识符字符串。

指定者:
接口 ExtendedRequest 中的 getID
返回:
对象标识符字符串 "1.3.6.1.4.1.1466.20037"。

getEncodedValue

public byte[] getEncodedValue()
检索 StartTLS 请求的 ASN.1 BER 编码值。因为该请求没有定义任何值,所以始终返回 null。

指定者:
接口 ExtendedRequest 中的 getEncodedValue
返回:
null 值。

createExtendedResponse

public ExtendedResponse createExtendedResponse(String id,
                                               byte[] berValue,
                                               int offset,
                                               int length)
                                        throws NamingException
创建与 LDAP StartTLS 扩展请求相对应的扩展响应对象。

结果必须为 StartTlsResponse 的具体子类,并且必须具有不带参数的公共构造方法。

此方法通过查找具有以下名称的配置文件来查找实现类:

META-INF/services/javax.naming.ldap.StartTlsResponse
配置文件及其相应的实现类对于调用线程的上下文类加载器而言必须是可访问的。

每个配置文件应该包含一个完全限定类名称列表,每行一个类名。忽略各名称周围的空格字符和制表符以及空行。注释字符为 '#' (0x23);将忽略每行第一个注释字符后面的所有字符。文件必须使用 UTF-8 编码。

此方法将返回它能够从类名称列表(通过配置文件收集)成功加载和实例化的第一个实现类的实例。此方法使用调用线程的上下文类加载器查找配置文件和加载实现类。

如果使用此方式找不到任何类,则此方法将使用特定于实现的方式来查找实现。如果一个也找不到,则抛出 NamingException。

指定者:
接口 ExtendedRequest 中的 createExtendedResponse
参数:
id - 扩展响应的对象标识符。其值必须为 "1.3.6.1.4.1.1466.20037" 或 null。两个值是等价的。
berValue - 扩展响应的 ASN.1 BER 编码值(可能为 null)。此为原始 BER 字节,包括响应值的标记和长度。它不包括响应 OID。它的值将被忽略,因为不要求 Start TLS 响应包含任何响应值。
offset - berValue 中要使用的字节的开始位置。它的值将被忽略,因为不要求 Start TLS 响应包含任何响应值。
length - berValue 中要使用的字节数。它的值将被忽略,因为不要求 Start TLS 响应包含任何响应值。
返回:
StartTLS 扩展响应对象。
抛出:
NamingException - 如果在创建 StartTLS 扩展响应对象时遇到命名异常。
另请参见:
ExtendedResponse

JavaTM 2 Platform
Standard Ed. 6

提交错误或意见
有关更多的 API 参考资料和开发人员文档,请参阅 Java 2 SDK SE 开发人员文档。该文档包含更详细的、面向开发人员的描述,以及总体概述、术语定义、使用技巧和工作代码示例。

版权所有 2004 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。另请参阅文档重新分发政策