image.png

1.Java 安全工具

Keytool

keytool为java原生自带,安装java后不需要再进行安装,作为密钥和证书管理工具,方便用户能够管理自己的公钥/私钥及证书,用于认证服务。
-certreq:生成证书请求
-changealias:更改条目的别名
-delete:删除条目
-exportcert:导出证书
-genkeypair:生成密钥对
-genseckey:生成密钥
-gencert:根据证书请求生成证书
-importcert:导入证书或证书链
-importpass:导入口令
-importkeystore:从其他密钥库导入一个或所有条目
-keypasswd:更改条目的密钥口令
-list:列出密钥库中的条目
-printcert:打印证书内容
-printcertreq:打印证书请求的内容
-printcrl:打印 CRL 文件的内容
-storepasswd:更改密钥库的存储口令

Jarsigner

public final class JarSigner
extends Object
一个不可变的实用程序类来签名一个jar文件。
调用者创建一个JarSigner.Builder对象,(可选)设置一些参数,并调用build创建一个JarSigner对象。 然后可以使用此JarSigner对象来签名jar文件。

除非另有说明,否则使用null参数调用JarSigner或JarSigner.Builder的方法将抛出一个NullPointerException 。

例:

JarSigner signer = new JarSigner.Builder(key, certPath)

     .digestAlgorithm("SHA-1")
     .signatureAlgorithm("SHA1withDSA")
     .build();

try (ZipFile in = new ZipFile(inputFile);

     FileOutputStream out = new FileOutputStream(outputFile)) {
 signer.sign(in, out);

}
从以下版本开始:
9

Policytool

policytool
Reads and writes a plain text policy file based on user input through the utility GUI.

Synopsis
policytool [ -file ] [ filename ]

-file
Directs the policytool command to load a policy file.

filename
The name of the file to be loaded.

Examples:

Run the policy tool administrator utility:

policytool
Run the policytool command and load the specified file:

policytool -file mypolicyfile
Description
The policytool command calls an administrator's GUI that enables system administrators to manage the contents of local policy files. A policy file is a plain-text file with a .policy extension, that maps remote requestors by domain, to permission objects. For details, see Default Policy Implementation and Policy File Syntax at
http://docs.oracle.com/javase/8/docs/technotes/guides/securit...

Options
-file
Directs the policytool command to load a policy file.

See Also
Default Policy Implementation and Policy File Syntax at
http://docs.oracle.com/javase/8/docs/technotes/guides/securit...

Policy File Creation and Management at
http://docs.oracle.com/javase/8/docs/technotes/guides/securit...

Permissions in Java SE Development Kit (JDK) at
http://docs.oracle.com/javase/8/docs/technotes/guides/securit...

Java Security Overview at
http://docs.oracle.com/javase/8/docs/technotes/guides/securit...

Java Cryptography Architecture (JCA) Reference Guide at
http://docs.oracle.com/javase/8/docs/technotes/guides/securit...

JAAS(Java Authentication and Authorization Service)

JAAS全称为 Java Authentication Authorization Service,中文含义即Java认证和授权服务。使用可插入方式将认证和授权逻辑和应用程序分离开。


执于代码
1 声望0 粉丝

« 上一篇
Java 安全机制
下一篇 »
Java 安全问题