public static class KeyStore.PasswordProtection extends Object implements KeyStore.ProtectionParameter, Destroyable
ProtectionParameter 。
| Constructor and Description |
|---|
PasswordProtection(char[] password)
创建一个密码参数。
|
PasswordProtection(char[] password, String protectionAlgorithm, AlgorithmParameterSpec protectionParameters)
创建密码参数,并指定在加密密钥库条目时使用的保护算法和相关参数。
|
| Modifier and Type | Method and Description |
|---|---|
void |
destroy()
清除密码。
|
char[] |
getPassword()
获取密码。
|
String |
getProtectionAlgorithm()
获取保护算法的名称。
|
AlgorithmParameterSpec |
getProtectionParameters()
获取为保护算法提供的参数。
|
boolean |
isDestroyed()
确定密码是否已被清除。
|
public PasswordProtection(char[] password)
指定的password在存储在新的PasswordProtection对象之前被克隆。
password - 密码,可能是
null
public PasswordProtection(char[] password,
String protectionAlgorithm,
AlgorithmParameterSpec protectionParameters)
指定的password在存储在新的PasswordProtection对象之前被克隆。
password - 密码,可能是
null
protectionAlgorithm - 加密算法名称,例如PBEWithHmacSHA256AndAES_256 。
有关标准加密算法名称的信息,请参阅Java Cryptography Architecture Standard Algorithm Name Documentation中的密码部分。
protectionParameters - 加密算法参数规范,可以是
null
NullPointerException - 如果
protectionAlgorithm是
null
public String getProtectionAlgorithm()
'keystore.<type>.keyProtectionAlgorithm'安全属性设置给定密钥库类型的默认保护算法的名称。
例如, keystore.PKCS12.keyProtectionAlgorithm属性存储用于PKCS12密钥库的默认密钥保护算法的名称。
如果未设置security属性,将使用实现特定的算法。
null
public AlgorithmParameterSpec getProtectionParameters()
null ,如果没有设置
public char[] getPassword()
请注意,此方法返回对密码的引用。 如果创建了数组的克隆,则呼叫者有责任在不再需要密码信息后将其清除。
null
IllegalStateException - 如果密码已被清除(销毁)
destroy()
public void destroy()
throws DestroyFailedException
destroy在界面
Destroyable
DestroyFailedException - 如果此方法无法清除密码
public boolean isDestroyed()
isDestroyed在界面
Destroyable
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.