'OSX + Java + OpenSSL + org.apache.commons:commons-crypto = SegFault in OpenSslNative:initIDs
I had a simple Java class using Apache:commons-crypto to do encryption/decryption that was SegFaulting on me.
On OSX, I used Homebrew to install the latest OpenSSL to use.
Tracing down the issue, it occurred in the OpenSslNative:initIDs JNI linked native code somewhere. I found the c code here:
https://github.com/apache/commons-crypto/blob/master/src/main/native/org/apache/commons/crypto/cipher/OpenSslNative.c
https://github.com/apache/commons-crypto/blob/master/lib/include/config.h
Scanning through the code, I found that on OSX, the "libcrypto.dylib" is referenced. That library was correctly linked into the /usr/local/opt/openssl/lib directory.
Solution 1:[1]
Confident that the libs were not found, I updated my ~/.zshrc to include
export DYLD_LIBRARY_PATH="/usr/local/opt/openssl/lib"
My code worked again now that the library could be found.
If there is a better way to make this work, I would be interested in knowing it.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Chris |
