Java的OpenSSL [英] OpenSSL with Java

查看:426
本文介绍了Java的OpenSSL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须在Java Web项目中使用OpenSSL,但我对"OpenSSL"一无所知.

I have to use OpenSSL in a Java web project and I don't know anything about 'OpenSSL'.

如何将OpenSSL与我的项目集成?有什么好的基础教程可以学习吗?

How can I integrate OpenSSL with my project? is there any good fundamental tutorials to learn this?

推荐答案

首先:您需要该库做什么?

First of all: what do you need the library for?

  • 如果要使用简单的加密功能,请使用 BouncyCastle 是最受欢迎的游戏之一)
  • 但是,如果您需要打开Java代码中的SSL连接并处理证书身份验证等,则不需要以下任何一项:
    • 如果您使用的是Java EE容器,则您的容器可以验证传入的SSL请求:这只是配置问题
    • 此外,如果您需要连接到SSL端口,则JDK会提供一些基本的类(请参见此示例).请注意,在这种情况下,您需要在java命令上设置一些系统属性.
    • 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.

      像这些属性一样:

      -Djavax.net.ssl.keyStore=keystore_path
      -Djavax.net.ssl.keyStorePassword=password
      -Djavax.net.ssl.trustStore=truststore_path
      -Djavax.net.ssl.trustStorePassword=trustword
      

      这篇关于Java的OpenSSL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆