public abstract static class KeyStore.Builder extends Object
这个类的一个实例封装需要实例化和初始化密钥库中对象的信息。这一过程被触发时,getKeyStore()方法称为。
这使得它有可能将从密钥库中对象的创建和配置,例如延迟密码提示直到需要它。
KeyStore,
KeyStoreBuilderParameters
| Modifier | Constructor and Description |
|---|---|
protected |
Builder()
构建一个新的生成器。
|
| Modifier and Type | Method and Description |
|---|---|
abstract KeyStore |
getKeyStore()
返回KeyStore所描述的这个对象。
|
abstract KeyStore.ProtectionParameter |
getProtectionParameter(String alias)
返回应用于获取与给定的别名
Entry的保护参量设计时。
|
static KeyStore.Builder |
newInstance(KeyStore keyStore, KeyStore.ProtectionParameter protectionParameter)
返回一个新的功能,封装了特定的密钥库。
|
static KeyStore.Builder |
newInstance(String type, Provider provider, File file, KeyStore.ProtectionParameter protection)
返回一个新的生成器对象。
|
static KeyStore.Builder |
newInstance(String type, Provider provider, KeyStore.ProtectionParameter protection)
返回一个新的生成器对象。
|
public abstract KeyStore getKeyStore() throws KeyStoreException
KeyStore描述的对象
KeyStoreException -如果在操作过程中出现错误,例如,如果KeyStore不能被实例化或加载
public abstract KeyStore.ProtectionParameter getProtectionParameter(String alias) throws KeyStoreException
Entry的保护参量设计时。的
getKeyStore方法必须调用此方法之前可以被称为。
alias -密钥输入别名
Entry的保护参量设计时。
NullPointerException如果别名是空的
KeyStoreException -如果在操作过程中出现了一个错误
IllegalStateException -如果getkeystore方法没有被调用之前调用此方法
public static KeyStore.Builder newInstance(KeyStore keyStore, KeyStore.ProtectionParameter protectionParameter)
keyStore,
getProtectionParameter()方法将返回
protectionParameters。
如果现有的密钥库对象需要使用Builder的API这是有用的。
keyStore -密钥库被封装
protectionParameter -用于保护KeyStore的作品protectionparameter
NullPointerException如果密钥或保护参量设计时是空的
IllegalArgumentException如果keystore尚未初始化
public static KeyStore.Builder newInstance(String type, Provider provider, File file, KeyStore.ProtectionParameter protection)
在返回船厂的getKeyStore()方法的第一次调用将创建一个密钥类型并调用其方法type load()。的inputStream争论是由file。如果protection是PasswordProtection,密码是通过调用getPassword方法得到的。否则,如果protection是CallbackHandlerProtection,密码是通过调用callbackhandler获得。
随后调用getKeyStore()作为初始调用返回相同的对象。如果初始调用失败,一keystoreexception,随后的电话也扔了一keystoreexception。
密钥库实例化从provider如果非空。否则,所有已安装的供应商都被搜索。
电话getProtectionParameter()将返回一个PasswordProtection对象封装,用于调用load方法密码。
请注意,getKeyStore()方法是在AccessControlContext的代码调用该方法的执行。
type -构造密钥库的类型
provider -供应商,KeyStore是被实例化(或零)
file -包含密钥库数据文件
protection - protectionparameter安全密钥库数据
NullPointerException如果类型、文件或保护是无效的
IllegalArgumentException如果保护是没有密码保护或callbackhandlerprotection实例;如果文件不存在或不是指一个普通的文件
public static KeyStore.Builder newInstance(String type, Provider provider, KeyStore.ProtectionParameter protection)
每次打电话给getKeyStore()方法返回的建设者将返回一个新的类型type密钥库对象。其load()方法是使用一个LoadStoreParameter protection调用封装。
密钥库实例化从provider如果非空。否则,所有已安装的供应商都被搜索。
调用将返回protection getProtectionParameter()。
请注意,getKeyStore()方法是在AccessControlContext的代码调用该方法的执行。
type -构造密钥库的类型
provider -供应商,KeyStore是被实例化(或零)
protection - protectionparameter安全密钥
NullPointerException如果型或保护是无效的
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.