javaopenssl
① java程序如何使用openssl
First of all: what do you need the library for?
If you are going to use simple cryptographic functions, then use the Java SE Security components deployed with the JDK.
If you need more advanced functions (such as some digital signing formats, etc), use a cryptographic library (BouncyCastle is one of the the most popular)
But, if what you need is to open SSL connections from Java code, and
handle certificates authentication, etc, you won't need any of these:
If you are working on a Java EE Container, your container can
validate incoming SSL requests: it's just a matter of configuration
Also, if you need to connect to a SSL port, the JDK presents some basic classes for doing so (see this example). Note that in this case, you'll need to set some system properties on your java command.
Like these properties:
-Djavax.net.ssl.keyStore=keystore_path-Djavax.net.ssl.keyStorePassword=password-Djavax.net.ssl.trustStore=truststore_path-Djavax.net.ssl.trustStorePassword=trustword
http://stackoverflow.com/questions/5416194/openssl-with-java
② 如何在由openssl生成的java中使用.key和.crt文件
您好,这样:
第一步,从key和crt生成pkcs12格式的keystore
openssl pkcs12 -export -in mycert.crt -inkey mykey.key
-out mycert.p12 -name tomcat -CAfile myCA.crt
-caname root -chain
第二步 生成tomcat需要的keystore
keytool -importkeystore -v -srckeystore mycert.p12 -srcstoretype pkcs12 -srcstorepass 123456 -destkeystore tomcat.keystore -deststoretype jks -deststorepass 123456 。
③ openssl 生成的*.key文件。java怎么从中获得私钥
这个是pem格式的数字证书,可以尝试调用openssl的api函数PEM_read_bio_PrivateKey()来读取密钥。
④ java中 用到.cer的安全证书,如何通过openssl来生成这个证书
openssl貌似 linux系统里用的多, 也可以用java的keytool生成,jdk自带的.
⑤ 如何用Java调用Openssl生成一个数字证书
openssl genrsa -des3 -out server.key 1024运行时会提示输入密码,此密码用于加密key文件(参数des3便是指加密算法,当然也可以选用其他你认为安全的算法.),以后每当需读取此文件(通过openssl提供的命令或API)都需输入口令.如果觉得不方便,也可以..
⑥ java调用openssl的dll,用jni如何调用
sha1的java软算法也有,可以考虑用bouncycastle