Skip to content

Commit

Permalink
Allow to get version of available OpenSSL library
Browse files Browse the repository at this point in the history
Motivation:

Sometimes it's useful to get informations about the available OpenSSL library that is used for the OpenSslEngine.

Modifications:

Add two new methods which allows to get the available OpenSSL version as either
an int or an String.

Result:

Easy to access details about OpenSSL version.
  • Loading branch information
normanmaurer committed Apr 18, 2015
1 parent 2b8104c commit 3850cff
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion handler/src/main/java/io/netty/handler/ssl/OpenSsl.java
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,29 @@ public static boolean isAvailable() {
* <a href="https://tools.ietf.org/html/rfc7301">ALPN</a>.
*/
public static boolean isAlpnSupported() {
return isAvailable() && SSL.version() >= 0x10002000L;
return version() >= 0x10002000L;
}

/**
* Returns the version of the used available OpenSSL library or {@code -1} if {@link #isAvailable()}
* returns {@code false}.
*/
public static int version() {
if (isAvailable()) {
return SSL.version();
}
return -1;
}

/**
* Returns the version string of the used available OpenSSL library or {@code null} if {@link #isAvailable()}
* returns {@code false}.
*/
public static String versionString() {
if (isAvailable()) {
return SSL.versionString();
}
return null;
}

/**
Expand Down

0 comments on commit 3850cff

Please sign in to comment.