Conversion of OpenSSL to Java