public class StartTlsRequest extends Object implements ExtendedRequest
StartTlsRequest / StartTlsResponse用于在现有的LDAP连接JNDI上下文中调用相关的extendedOperation()建立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;
StartTlsResponse
,
Serialized Form
Modifier and Type | Field and Description |
---|---|
static String |
OID
STARTTLS扩展请求指定的对象标识符是1.3.6.1.4.1.1466.20037。
|
Constructor and Description |
---|
StartTlsRequest()
构建了STARTTLS扩展请求。
|
Modifier and Type | Method and Description |
---|---|
ExtendedResponse |
createExtendedResponse(String id, byte[] berValue, int offset, int length)
创建对应的LDAP STARTTLS扩展请求扩展响应对象。
|
byte[] |
getEncodedValue()
检索STARTTLS请求的ASN.1 BER编码的值1。
|
String |
getID()
检索请求的对象标识符的字符串将。
|
public static final String OID
public String getID()
getID
接口
ExtendedRequest
public byte[] getEncodedValue()
getEncodedValue
接口
ExtendedRequest
public ExtendedResponse createExtendedResponse(String id, byte[] berValue, int offset, int length) throws NamingException
其结果必须是一个具体的子类starttlsresponse,必须有一个公共的零参数的构造函数。
该方法通过定位具有名称的配置文件来定位实现类:
META-INF/services/javax.naming.ldap.StartTlsResponse配置文件和相应的实现类必须调用线程的上下文类加载器访问。
每个配置文件应该包含一个完全限定的类名称的列表,每行一个。围绕每个名称的空格和制表符,以及空白行,都将被忽略。评论性'#'(0x23);每一行的所有字符的第一个评论的性格被忽略。该文件必须是UTF-8编码。
该方法将返回一个实例的实现类,它能够加载并实例化成功地从类的名称从配置文件中收集名单。此方法使用调用线程的上下文类加载器查找配置文件和加载类的实现。
如果没有这样的类可以被发现,这种方法将使用一个实现特定的方法来定位一个实现。如果没有发现,一个namingexception抛出。
createExtendedResponse
接口
ExtendedRequest
id
-扩展响应对象标识符。它的值必须是“1.3.6.1.4.1.1466.20037”或空。这两个值是等价的。
berValue
-可能的空ASN.1 BER编码1扩展响应值。这是原始的比特率字节,包括标签和响应值的长度。它不包括响应OID。忽略因为启动TLS反应将不会包含任何反应的价值是它的价值。
offset
-起始位置的字节bervalue使用。忽略因为启动TLS反应将不会包含任何反应的价值是它的价值。
length
- bervalue字节数的使用。忽略因为启动TLS反应将不会包含任何反应的价值是它的价值。
NamingException
-如果在创建STARTTLS扩展响应对象遇到的是一个命名的例外。
ExtendedResponse
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.