使用OpenSSL支持的密码时如下:
Properties properties = new Properties();
properties.setProperty(CryptoCipherFactory.CLASSES_KEY,
CipherProvider.OPENSSL.getClassName());
我收到以下错误:
java.security.GeneralSecurityException: CryptoCipher {org.apache.commons.crypto.cipher.OpenSslCipher} is not available or transformation AES/CTR/NoPadding is not supported
Caused by: java.lang.UnsatisfiedLinkError: EVP_CIPHER_CTX_cleanup
at org.apache.commons.crypto.cipher.OpenSslNative.initIDs(Native Method)
at org.apache.commons.crypto.cipher.OpenSsl.<clinit>(OpenSsl.java:95)
at org.apache.commons.crypto.cipher.OpenSslCipher.<init>(OpenSslCipher.java:57)
据我所知,这是由OpenSSl的链接失败引起的。我的LD_LIBRARY_PATH配置为指向包含libssl和libcrypto的/ usr / local / lib。我错过了什么?
我将代码运行为
java -cp nameofjar.jar my.package.name