add method to check if CRL is enabled in native wolfSSL

pull/9/head
Chris Conlon 2016-08-10 10:56:14 -06:00
parent de0e4e0a3a
commit 4ea4646e6c
5 changed files with 71 additions and 42 deletions

View File

@ -340,6 +340,7 @@ public class Client {
ssl = new WolfSSLSession(sslCtx);
/* enable/load CRL functionality */
if (WolfSSL.isEnabledCRL() == 1) {
ret = ssl.enableCRL(WolfSSL.WOLFSSL_CRL_CHECKALL);
if (ret != WolfSSL.SSL_SUCCESS) {
System.out.println("failed to enable CRL check");
@ -347,8 +348,8 @@ public class Client {
}
ret = ssl.loadCRL(crlPemDir, WolfSSL.SSL_FILETYPE_PEM, 0);
if (ret != WolfSSL.SSL_SUCCESS) {
System.out.println("can't load CRL, check CRL file and date " +
"validity");
System.out.println("can't load CRL, check CRL file and " +
"date validity");
System.exit(1);
}
MyMissingCRLCallback crlCb = new MyMissingCRLCallback();
@ -357,6 +358,7 @@ public class Client {
System.out.println("can't set CRL callback");
System.exit(1);
}
}
/* open Socket */
if (doDTLS == 1) {

View File

@ -351,6 +351,7 @@ public class Server {
}
/* enable/load CRL functionality */
if (WolfSSL.isEnabledCRL() == 1) {
ret = ssl.enableCRL(0);
if (ret != WolfSSL.SSL_SUCCESS) {
System.out.println("failed to enable CRL, ret = "
@ -384,6 +385,7 @@ public class Server {
+ ret);
System.exit(1);
}
}
if (useIOCallbacks || (doDTLS == 1)) {
/* register I/O callbacks */

View File

@ -409,3 +409,13 @@ JNIEXPORT jint JNICALL Java_com_wolfssl_WolfSSL_getHmacMaxSize
return MAX_DIGEST_SIZE;
}
JNIEXPORT jint JNICALL Java_com_wolfssl_WolfSSL_isEnabledCRL
(JNIEnv* jenv, jclass jcl)
{
#ifdef HAVE_CRL
return 1;
#else
return 0;
#endif
}

View File

@ -391,6 +391,14 @@ JNIEXPORT jbyteArray JNICALL Java_com_wolfssl_WolfSSL_x509_1getDer
JNIEXPORT jint JNICALL Java_com_wolfssl_WolfSSL_getHmacMaxSize
(JNIEnv *, jclass);
/*
* Class: com_wolfssl_WolfSSL
* Method: isEnabledCRL
* Signature: ()I
*/
JNIEXPORT jint JNICALL Java_com_wolfssl_WolfSSL_isEnabledCRL
(JNIEnv *, jclass);
#ifdef __cplusplus
}
#endif

View File

@ -587,5 +587,12 @@ public class WolfSSL {
*/
public static native int getHmacMaxSize();
/**
* Checks if CRL support is enabled in wolfSSL native library.
*
* @return 1 if enabled, 0 if not compiled in
*/
public static native int isEnabledCRL();
} /* end WolfSSL */