java.lang.Object
java.security.KeyStore.PasswordProtection
- 所有已实现的接口:
KeyStore.ProtectionParameter,Destroyable
- 封闭类:
KeyStore
public static class KeyStore.PasswordProtection extends Object implements KeyStore.ProtectionParameter , Destroyable
ProtectionParameter 的基于密码的实现。
- 自从:
- 1.5
-
构造方法总结
构造方法构造方法描述PasswordProtection(char[] password) 创建密码参数。PasswordProtection(char[] password, String protectionAlgorithm, AlgorithmParameterSpec protectionParameters) 创建密码参数并指定在加密密钥库条目时要使用的保护算法和相关参数。 -
方法总结
-
构造方法详细信息
-
PasswordProtection
public PasswordProtection(char[] password) 创建密码参数。指定的
password在存储到新的PasswordProtection对象之前被克隆。- 参数:
password- 密码,可能是null
-
PasswordProtection
public PasswordProtection(char[] password, String protectionAlgorithm, AlgorithmParameterSpec protectionParameters) 创建密码参数并指定在加密密钥库条目时要使用的保护算法和相关参数。指定的
password在存储到新的PasswordProtection对象之前被克隆。- 参数:
password- 密码,可能是nullprotectionAlgorithm- 加密算法名称,例如PBEWithHmacSHA256AndAES_256。有关标准加密算法名称的信息,请参阅 Java 安全标准算法名称规范 中的密码部分。protectionParameters——加密算法参数说明,可能是null- 抛出:
NullPointerException- 如果protectionAlgorithm是null- 自从:
- 1.8
-
-
方法详情
-
getProtectionAlgorithm
获取保护算法的名称。如果未设置,则密钥库提供程序将使用其默认保护算法。- 返回:
-
算法名称,如果未设置,则为
null - 自从:
- 1.8
-
getProtectionParameters
获取为保护算法提供的参数。- 返回:
-
算法参数规范,或
null,如果未设置 - 自从:
- 1.8
-
getPassword
public char[] getPassword()获取密码。请注意,此方法返回对密码的引用。如果创建了数组的克隆,调用者有责任在不再需要密码信息后将其清零。
- 返回:
-
密码,可能是
null - 抛出:
IllegalStateException- 如果密码已被清除(销毁)- 参见:
-
destroy
清除密码。- 指定者:
destroy在接口Destroyable中- 抛出:
DestroyFailedException- 如果此方法无法清除密码
-
isDestroyed
public boolean isDestroyed()确定密码是否已被清除。- 指定者:
isDestroyed在接口Destroyable中- 返回:
true如果密码已被清除,false否则
-