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)
克隆之前,它是存储在新的PasswordProtection
对象指定的password
。
password
-密码,这可能是
null
public PasswordProtection(char[] password, String protectionAlgorithm, AlgorithmParameterSpec protectionParameters)
克隆之前,它是存储在新的PasswordProtection
对象指定的password
。
password
-密码,这可能是
null
protectionAlgorithm
-加密算法的名称,例如,
PBEWithHmacSHA256AndAES_256
。看到有关标准加密算法名称的信息在
Java Cryptography Architecture Standard Algorithm Name Documentation密码部分。
protectionParameters
-加密算法参数规范,这可能是
null
null
protectionAlgorithm
NullPointerException
public String getProtectionAlgorithm()
'keystore.<type>.keyProtectionAlgorithm'
安全性能。例如,在
keystore.PKCS12.keyProtectionAlgorithm
属性存储的默认密钥保护算法用于12密钥名称。如果没有设置安全属性,将使用一个实现特定的算法。
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.