Example usage for javax.net.ssl SSLEngine wrap

List of usage examples for javax.net.ssl SSLEngine wrap

Introduction

In this page you can find the example usage for javax.net.ssl SSLEngine wrap.

Prototype

public SSLEngineResult wrap(ByteBuffer[] srcs, ByteBuffer dst) throws SSLException 

Source Link

Document

Attempts to encode plaintext bytes from a sequence of data buffers into SSL/TLS/DTLS network data.

Usage

From source file:org.apache.hc.client5.http.impl.auth.CredSspScheme.java

private void wrap(final ByteBuffer src, final ByteBuffer dst) throws AuthenticationException {
    final SSLEngine sslEngine = getSSLEngine();
    try {/*from  w w  w  .j a v  a 2  s .c o m*/
        final SSLEngineResult engineResult = sslEngine.wrap(src, dst);
        if (engineResult.getStatus() != Status.OK) {
            throw new AuthenticationException("SSL Engine error status: " + engineResult.getStatus());
        }
    } catch (final SSLException e) {
        throw new AuthenticationException("SSL Engine wrap error: " + e.getMessage(), e);
    }
}