Java次要/更新版本检查

时间:2018-08-08 11:37:09

标签: java shell

如何通过Shell脚本检查次要版本/更新版本。

例如我当前的命令输出

$ java -version
java version "1.8.0_171"

我正在使用需要Java更新> 161的256 AES。我想测试次要版本,如何执行。

1 个答案:

答案 0 :(得分:2)

如果您坚持要这样做,则可以遵循此discussion来获取Java的主要版本和次要版本,并在控制台上进行打印。

关于AES 256,默认情况下Java版本1.8.0_171已默认支持密钥大小> 128。以下是<JAVA_HOME>/jre/lib/security/java.security文件的摘录:-

# Cryptographic Jurisdiction Policy defaults
#
# Import and export control rules on cryptographic software vary from
# country to country.  By default, the JDK provides two different sets  of
# cryptographic policy files:
#
#     unlimited:  These policy files contain no restrictions on cryptographic
#                 strengths or algorithms.
#
#     limited:    These policy files contain more restricted cryptographic
#                 strengths, and are still available if your country or
#                 usage requires the traditional restrictive policy.
#
# The JDK JCE framework uses the unlimited policy files by default.
# However the user may explicitly choose a set either by defining the
# "crypto.policy" Security property or by installing valid JCE policy
# jar files into the traditional JDK installation location.  To better
# support older JDK Update releases, the "crypto.policy" property is not
# defined by default.  See below for more information.

要测试具有256个密钥强度的TLS连接,可以使用SSLPoke程序。用javac编译该程序并按以下方式运行:-

$java -Djavax.net.debug=all SSLPoke microsoft.com 443 | grep 'Cipher Suite: TLS'

如果SSL握手和连接成功,则将在控制台上打印密钥大小> 128的密码套件。