StartTlsResponse (Java SE 15 & JDK 15) (original) (raw)

All Implemented Interfaces:

[Serializable](../../../../java.base/java/io/Serializable.html "interface in java.io"), [ExtendedResponse](ExtendedResponse.html "interface in javax.naming.ldap")


public abstract class StartTlsResponse extends Object implements ExtendedResponse

This class implements the LDAPv3 Extended Response for StartTLS as defined inLightweight Directory Access Protocol (v3): Extension for Transport Layer Security The object identifier for StartTLS is 1.3.6.1.4.1.1466.20037 and no extended response value is defined.

The Start TLS extended request and response are used to establish a TLS connection over the existing LDAP connection associated with the JNDI context on which extendedOperation() is invoked. Typically, a JNDI program uses the StartTLS extended request and response classes as follows.

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, ... 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;

Since:

1.4

See Also:

StartTlsRequest, Serialized Form

Fields

Modifier and Type Field Description
static String OID The StartTLS extended response's assigned object identifier is 1.3.6.1.4.1.1466.20037.

Constructors

Modifier Constructor Description
protected StartTlsResponse() Constructs a StartTLS extended response.
Modifier and Type Method Description
abstract void close() Closes the TLS connection gracefully and reverts back to the underlying connection.
byte[] getEncodedValue() Retrieves the StartTLS response's ASN.1 BER encoded value.
String getID() Retrieves the StartTLS response's object identifier string.
abstract SSLSession negotiate() Negotiates a TLS session using the default SSL socket factory.
abstract SSLSession negotiate​(SSLSocketFactory factory) Negotiates a TLS session using an SSL socket factory.
abstract void setEnabledCipherSuites​(String[] suites) Overrides the default list of cipher suites enabled for use on the TLS connection.
abstract void setHostnameVerifier​(HostnameVerifier verifier) Sets the hostname verifier used by negotiate() after the TLS handshake has completed and the default hostname verification has failed.

Methods declared in class java.lang.Object

[clone](../../../../java.base/java/lang/Object.html#clone%28%29), [equals](../../../../java.base/java/lang/Object.html#equals%28java.lang.Object%29), [finalize](../../../../java.base/java/lang/Object.html#finalize%28%29), [getClass](../../../../java.base/java/lang/Object.html#getClass%28%29), [hashCode](../../../../java.base/java/lang/Object.html#hashCode%28%29), [notify](../../../../java.base/java/lang/Object.html#notify%28%29), [notifyAll](../../../../java.base/java/lang/Object.html#notifyAll%28%29), [toString](../../../../java.base/java/lang/Object.html#toString%28%29), [wait](../../../../java.base/java/lang/Object.html#wait%28%29), [wait](../../../../java.base/java/lang/Object.html#wait%28long%29), [wait](../../../../java.base/java/lang/Object.html#wait%28long,int%29)