wolfssljni/examples
Sage Stefonic bde37eec21 add rsa_pss support in wolfJSSE 2024-08-08 15:18:08 -07:00
..
certs Remove text meta data from ca-cert.pem, ca-ecc-cert.pem for Android compatibility 2024-04-09 10:38:04 -06:00
provider add rsa_pss support in wolfJSSE 2024-08-08 15:18:08 -07:00
Client.java JNI/JSSE: correctly free WOLFSSL_X509 from wolfSSL_get_peer_certificate() for wolfSSL >= 5.3.0 2024-04-17 15:59:50 -06:00
MyALPNSelectCallback.java update copyright to 2024 2024-01-16 15:35:09 -07:00
MyAtomicDecCtx.java update copyright to 2024 2024-01-16 15:35:09 -07:00
MyAtomicEncCtx.java update copyright to 2024 2024-01-16 15:35:09 -07:00
MyDecryptVerifyCallback.java update copyright to 2024 2024-01-16 15:35:09 -07:00
MyEccSharedSecretCallback.java update copyright to 2024 2024-01-16 15:35:09 -07:00
MyEccSharedSecretCtx.java update copyright to 2024 2024-01-16 15:35:09 -07:00
MyEccSignCallback.java update copyright to 2024 2024-01-16 15:35:09 -07:00
MyEccSignCtx.java update copyright to 2024 2024-01-16 15:35:09 -07:00
MyEccVerifyCallback.java update copyright to 2024 2024-01-16 15:35:09 -07:00
MyEccVerifyCtx.java update copyright to 2024 2024-01-16 15:35:09 -07:00
MyGenCookieCallback.java update copyright to 2024 2024-01-16 15:35:09 -07:00
MyGenCookieCtx.java update copyright to 2024 2024-01-16 15:35:09 -07:00
MyIOCtx.java update copyright to 2024 2024-01-16 15:35:09 -07:00
MyLoggingCallback.java update copyright to 2024 2024-01-16 15:35:09 -07:00
MyMacEncryptCallback.java update copyright to 2024 2024-01-16 15:35:09 -07:00
MyMissingCRLCallback.java update copyright to 2024 2024-01-16 15:35:09 -07:00
MyPskClientCallback.java update copyright to 2024 2024-01-16 15:35:09 -07:00
MyPskServerCallback.java update copyright to 2024 2024-01-16 15:35:09 -07:00
MyRecvCallback.java update copyright to 2024 2024-01-16 15:35:09 -07:00
MyRsaDecCallback.java update copyright to 2024 2024-01-16 15:35:09 -07:00
MyRsaDecCtx.java update copyright to 2024 2024-01-16 15:35:09 -07:00
MyRsaEncCallback.java update copyright to 2024 2024-01-16 15:35:09 -07:00
MyRsaEncCtx.java update copyright to 2024 2024-01-16 15:35:09 -07:00
MyRsaSignCallback.java update copyright to 2024 2024-01-16 15:35:09 -07:00
MyRsaSignCtx.java update copyright to 2024 2024-01-16 15:35:09 -07:00
MyRsaVerifyCallback.java update copyright to 2024 2024-01-16 15:35:09 -07:00
MyRsaVerifyCtx.java update copyright to 2024 2024-01-16 15:35:09 -07:00
MySendCallback.java update copyright to 2024 2024-01-16 15:35:09 -07:00
MyTls13SecretCallback.java JNI: correct example MyTls13SecretCallback CLIENT_TRAFFIC_SECRET and SERVER_TRAFFIC_SECRET 2024-04-25 16:59:45 -06:00
README.md JNI: add example threaded client/server applications, client does session resumption with get/setSession() 2024-07-19 13:07:46 -06:00
Server.java JNI/JSSE: correctly free WOLFSSL_X509 from wolfSSL_get_peer_certificate() for wolfSSL >= 5.3.0 2024-04-17 15:59:50 -06:00
SimpleThreadedClient.java JNI: add example threaded client/server applications, client does session resumption with get/setSession() 2024-07-19 13:07:46 -06:00
SimpleThreadedClient.sh JNI: add example threaded client/server applications, client does session resumption with get/setSession() 2024-07-19 13:07:46 -06:00
SimpleThreadedServer.java JNI: add example threaded client/server applications, client does session resumption with get/setSession() 2024-07-19 13:07:46 -06:00
SimpleThreadedServer.sh JNI: add example threaded client/server applications, client does session resumption with get/setSession() 2024-07-19 13:07:46 -06:00
VerifyCallback.java update copyright to 2024 2024-01-16 15:35:09 -07:00
WindowsConfig.bat Fix Windows build warnings, update WindowsConfig.bat, ALPN bytes test in WolfSSLSession 2024-04-05 16:20:03 -06:00
X509CertRequest.bat JNI: add Certificate Signing Request (CSR) support with WolfSSLCertRequest class, and example in X509CertRequest.java 2023-09-01 16:44:35 -06:00
X509CertRequest.java update copyright to 2024 2024-01-16 15:35:09 -07:00
X509CertRequest.sh JNI: add Certificate Signing Request (CSR) support with WolfSSLCertRequest class, and example in X509CertRequest.java 2023-09-01 16:44:35 -06:00
X509v3CertificateGeneration.bat Windows: add .bat scripts for running X509 and ProviderTest example 2023-08-22 15:25:09 -06:00
X509v3CertificateGeneration.java update copyright to 2024 2024-01-16 15:35:09 -07:00
X509v3CertificateGeneration.sh JNI: add X509v3 certificate generation support to WolfSSLCertificate class, supporting key usage, extended key usage, subject alt name, and basic constraints extensions. Self signed and CA-signed support, along with example app. Update example certs to match current wolfssl. 2023-08-22 15:25:06 -06:00
client.sh
server.sh

README.md

wolfSSL JNI Examples

This directory contains examples for the wolfSSL thin JNI wrapper. To view examples for the wolfSSL JSSE provider, look in the ./examples/provider directory.

Examples should be run from the package root directory, and using the provided wrapper scripts. The wrapper scripts set up the correct environment variables for use with the wolfjni jar included in the wolfssljni package.

Notes on Debug and Logging

wolfJSSE debug logging can be enabled by using -Dwolfjsse.debug=true at runtime.

wolfSSL native debug logging can be enabled by using -Dwolfssl.debug=true at runtime, if native wolfSSL has been compiled with --enable-debug.

JDK debug logging can be enabled using the -Djavax.net.debug=all option.

wolfSSL JNI Example Client and Server

Example client/server applications that use wolfSSL JNI:

Server.java - Example wolfSSL JNI server
Client.java - Example wolfSSL JNI client

These examples can be run with the provided bash scripts:

$ cd <wolfssljni_root>
$ ./examples/server.sh <options>
$ ./examples/client.sh <options>

To view usage and available options for the examples, use the -? argument:

$ ./examples/server.sh --help

wolfSSL JNI Example Simple Threaded Client and Server

Example client/server applications that use threads, which use wolfSSL JNI (not JSSE):

SimpleThreadedClient.java - Example wolfSSL JNI threaded client
SimpleThreadedServer.java - Example wolfSSL JNI threaded server

These examples can be run with the provided bash scripts:

$ cd <wolfssljni_root>
$ ./examples/SimpleThreadedServer.sh
$ ./examples/SimpleThreadedClient.sh -n <num_connections>

The SimpleThreadedServer.java starts at localhost:11111 and waits for client connections. When a client connection is received, it is handled in a separate thread.

The SimpleThreadedClient.java makes concurrent client connections to a server located at localhost:11111. Default number of client threads is 5, but can be changed using the -n <num_connections> command line argument. This example implements a simple application-wide Java client cache where native WOLFSSL_SESSION pointers are stored and used for session resumption where possible. See code comments for further explanation.

X509v3 Certificate Generation Example

An example is included which will generate self-signed and CA-signed X.509v3 certificates using the wolfSSL JNI library WolfSSLCertificate class.

X509v3CertificateGeneration.java - Certificate generation example

This example is compiled when the ant examples target is executed, and can be run afterwards with the provided bash script:

$ cd <wolfssljni_root>
$ ./examples/X509v3CertificateGeneration.sh

This will write out generated certificates to the following directory:

examples/certs/generated/

Certificate Signing Request (CSR) Generation Example

An example is included which will generate Certificate Signing Requests (CSR) using the wolfSSL JNI library WolfSSLCertRequest class.

X509CertRequest.java - CSR generation example

This example is compiled when the ant examples target is executed, and can be run afterwards with the provided bash script:

$ cd <wolfssljni_root>
$ ./examples/X509CertRequest.sh

This will write out generated CSRs to the following directory:

examples/certs/generated/

Support

Please contact the wolfSSL support team at support@wolfssl.com with any questions or feedback.