Java Code Examples for org.apache.tomcat.jni.SSLContext

The following are top voted examples for showing how to use org.apache.tomcat.jni.SSLContext. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: netty4.0.27Learn   File: OpenSslSessionStats.java   Source Code and License 6 votes vote down vote up
/**
 * Returns the number of sessions that were removed because the maximum session cache size was exceeded.
 */
public long cacheFull() {
    return SSLContext.sessionCacheFull(context);
}
 
Example 2
Project: netty4.0.27Learn   File: OpenSslServerSessionContext.java   Source Code and License 5 votes vote down vote up
@Override
public void setSessionTimeout(int seconds) {
    if (seconds < 0) {
        throw new IllegalArgumentException();
    }
    SSLContext.setSessionCacheTimeout(context, seconds);
}
 
Example 3
Project: netty4.0.27Learn   File: OpenSslServerSessionContext.java   Source Code and License 5 votes vote down vote up
@Override
public void setSessionCacheSize(int size) {
    if (size < 0) {
        throw new IllegalArgumentException();
    }
    SSLContext.setSessionCacheSize(context, size);
}
 
Example 4
Project: netty4.0.27Learn   File: OpenSslSessionContext.java   Source Code and License 5 votes vote down vote up
/**
 * Sets the SSL session ticket keys of this context.
 */
public void setTicketKeys(byte[] keys) {
    if (keys == null) {
        throw new NullPointerException("keys");
    }
    SSLContext.setSessionTicketKeys(context, keys);
}
 
Example 5
Project: netty4.0.27Learn   File: OpenSslContext.java   Source Code and License 5 votes vote down vote up
@Override
@SuppressWarnings("FinalizeDeclaration")
protected final void finalize() throws Throwable {
    super.finalize();
    synchronized (OpenSslContext.class) {
        if (ctx != 0) {
            SSLContext.free(ctx);
        }
    }

    destroyPools();
}
 
Example 6
Project: netty4.0.27Learn   File: OpenSslSessionStats.java   Source Code and License 4 votes vote down vote up
/**
 * Returns the current number of sessions in the internal session cache.
 */
public long number() {
    return SSLContext.sessionNumber(context);
}
 
Example 7
Project: netty4.0.27Learn   File: OpenSslSessionStats.java   Source Code and License 4 votes vote down vote up
/**
 * Returns the number of started SSL/TLS handshakes in client mode.
 */
public long connect() {
    return SSLContext.sessionConnect(context);
}
 
Example 8
Project: netty4.0.27Learn   File: OpenSslSessionStats.java   Source Code and License 4 votes vote down vote up
/**
 * Returns the number of successfully established SSL/TLS sessions in client mode.
 */
public long connectGood() {
    return SSLContext.sessionConnectGood(context);
}
 
Example 9
Project: netty4.0.27Learn   File: OpenSslSessionStats.java   Source Code and License 4 votes vote down vote up
/**
 * Returns the number of start renegotiations in client mode.
 */
public long connectRenegotiate() {
    return SSLContext.sessionConnectRenegotiate(context);
}
 
Example 10
Project: netty4.0.27Learn   File: OpenSslSessionStats.java   Source Code and License 4 votes vote down vote up
/**
 * Returns the number of started SSL/TLS handshakes in server mode.
 */
public long accept() {
    return SSLContext.sessionAccept(context);
}
 
Example 11
Project: netty4.0.27Learn   File: OpenSslSessionStats.java   Source Code and License 4 votes vote down vote up
/**
 * Returns the number of successfully established SSL/TLS sessions in server mode.
 */
public long acceptGood() {
    return SSLContext.sessionAcceptGood(context);
}
 
Example 12
Project: netty4.0.27Learn   File: OpenSslSessionStats.java   Source Code and License 4 votes vote down vote up
/**
 * Returns the number of start renegotiations in server mode.
 */
public long acceptRenegotiate() {
    return SSLContext.sessionAcceptRenegotiate(context);
}
 
Example 13
Project: netty4.0.27Learn   File: OpenSslSessionStats.java   Source Code and License 4 votes vote down vote up
/**
 * Returns the number of successfully retrieved sessions from the external session cache in server mode.
 */
public long cbHits() {
    return SSLContext.sessionCbHits(context);
}
 
Example 14
Project: netty4.0.27Learn   File: OpenSslServerSessionContext.java   Source Code and License 4 votes vote down vote up
@Override
public int getSessionTimeout() {
    return (int) SSLContext.getSessionCacheTimeout(context);
}
 
Example 15
Project: netty4.0.27Learn   File: OpenSslServerSessionContext.java   Source Code and License 4 votes vote down vote up
@Override
public int getSessionCacheSize() {
    return (int) SSLContext.getSessionCacheSize(context);
}
 
Example 16
Project: netty4.0.27Learn   File: OpenSslServerSessionContext.java   Source Code and License 4 votes vote down vote up
@Override
public void setSessionCacheEnabled(boolean enabled) {
    long mode = enabled ? SSL.SSL_SESS_CACHE_SERVER : SSL.SSL_SESS_CACHE_OFF;
    SSLContext.setSessionCacheMode(context, mode);
}
 
Example 17
Project: netty4.0.27Learn   File: OpenSslServerSessionContext.java   Source Code and License 4 votes vote down vote up
@Override
public boolean isSessionCacheEnabled() {
    return SSLContext.getSessionCacheMode(context) == SSL.SSL_SESS_CACHE_SERVER;
}
 
Example 18
Project: netty4.0.27Learn   File: OpenSslSessionStats.java   Source Code and License 2 votes vote down vote up
/**
 * Returns the number of successfully reused sessions. In client mode, a session set with {@code SSL_set_session}
 * successfully reused is counted as a hit. In server mode, a session successfully retrieved from internal or
 * external cache is counted as a hit.
 */
public long hits() {
    return SSLContext.sessionHits(context);
}
 
Example 19
Project: netty4.0.27Learn   File: OpenSslSessionStats.java   Source Code and License 2 votes vote down vote up
/**
 * Returns the number of sessions proposed by clients that were not found in the internal session cache
 * in server mode.
 */
public long misses() {
    return SSLContext.sessionMisses(context);
}
 
Example 20
Project: netty4.0.27Learn   File: OpenSslSessionStats.java   Source Code and License 2 votes vote down vote up
/**
 * Returns the number of sessions proposed by clients and either found in the internal or external session cache
 * in server mode, but that were invalid due to timeout. These sessions are not included in the {@link #hits()}
 * count.
 */
public long timeouts() {
    return SSLContext.sessionTimeouts(context);
}
 
Example 21
Project: netty4.0.27Learn   File: OpenSslServerSessionContext.java   Source Code and License 2 votes vote down vote up
/**
 * Set the context within which session be reused (server side only)
 * See <a href="http://www.openssl.org/docs/ssl/SSL_CTX_set_session_id_context.html">
 *     man SSL_CTX_set_session_id_context</a>
 *
 * @param sidCtx can be any kind of binary data, it is therefore possible to use e.g. the name
 *               of the application and/or the hostname and/or service name
 * @return {@code true} if success, {@code false} otherwise.
 */
public boolean setSessionIdContext(byte[] sidCtx) {
    return SSLContext.setSessionIdContext(context, sidCtx);
}