- java.lang.Object
 -  
      
- java.security.KeyStore.PasswordProtection
 
 
-  
       
- 实现的所有接口
 -  
         
KeyStore.ProtectionParameter,Destroyable 
- Enclosing class:
 - 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)创建密码参数并指定加密密钥库条目时要使用的保护算法和关联参数。 
-  
             
方法摘要
所有方法 实例方法 具体的方法 变量和类型 方法 描述 voiddestroy()清除密码。char[]getPassword()获取密码。StringgetProtectionAlgorithm()获取保护算法的名称。AlgorithmParameterSpecgetProtectionParameters()获取为保护算法提供的参数。booleanisDestroyed()确定密码是否已被清除。 
 -  
             
 
-  
        
       
-  
             
构造方法详细信息
-  
PasswordProtection
public PasswordProtection(char[] password)
创建密码参数。指定的
password在存储到新的PasswordProtection对象之前进行克隆。- 参数
 -  
              
password- 密码,可以是null 
 
-  
PasswordProtection
public PasswordProtection(char[] password, String protectionAlgorithm, AlgorithmParameterSpec protectionParameters)创建密码参数并指定加密密钥库条目时要使用的保护算法和关联参数。指定的
password在存储到新的PasswordProtection对象之前进行克隆。- 参数
 -  
              
password- 密码,可能是null -  
              
protectionAlgorithm- 加密算法名称,例如,PBEWithHmacSHA256AndAES_256。 有关标准加密算法名称的信息,请参见Java Security Standard Algorithm Names Specification中的密码部分。 -  
              
protectionParameters- 加密算法参数规范,可以是null - 异常
 -  
              
NullPointerException- 如果protectionAlgorithm是null - 从以下版本开始:
 - 1.8
 
 
 -  
 
-  
             
方法详细信息
-  
getProtectionAlgorithm
public String getProtectionAlgorithm()
获取保护算法的名称。 如果未设置,则密钥库提供程序将使用其默认保护算法。 使用'keystore.<type>.keyProtectionAlgorithm'安全属性设置给定密钥库类型的默认保护算法的名称。 例如,keystore.PKCS12.keyProtectionAlgorithm属性存储用于PKCS12密钥库的默认密钥保护算法的名称。 如果未设置安全性属性,则将使用特定于实现的算法。- 结果
 - 
               算法名称,如果没有设置, 
              
null - 从以下版本开始:
 - 1.8
 
 
-  
getProtectionParameters
public AlgorithmParameterSpec getProtectionParameters()
获取为保护算法提供的参数。- 结果
 - 
               算法参数规范,或 
              
null,如果没有设置 - 从以下版本开始:
 - 1.8
 
 
-  
getPassword
public char[] getPassword()
获取密码。请注意,此方法返回对密码的引用。 如果创建了阵列的克隆,则呼叫者有责任在不再需要密码信息后将其清零。
- 结果
 - 
               密码,可能是 
              
null - 异常
 -  
              
IllegalStateException- 如果密码已被清除(销毁) - 另请参见:
 -  
              
destroy() 
 
-  
destroy
public void destroy() throws DestroyFailedException清除密码。- Specified by:
 -  
              
destroy在界面Destroyable - 异常
 -  
              
DestroyFailedException- 如果此方法无法清除密码 
 
-  
isDestroyed
public boolean isDestroyed()
确定密码是否已被清除。- Specified by:
 -  
              
isDestroyed在界面Destroyable - 结果
 - 如果密码已被清除,则为true,否则为false
 
 
 -  
 
 -