|
JavaTM 2 Platform Standard Ed. 6 |
|||||||||
| 上一個類別 下一個類別 | 框架 無框架 | |||||||||
| 摘要: 巢狀 | 欄位 | 建構子 | 方法 | 詳細資訊: 欄位 | 建構子 | 方法 | |||||||||
java.lang.Objectjava.security.KeyStore.Builder
public abstract static class KeyStore.Builder
將被實例化的 KeyStore 物件的描述。
此類別的實例封裝了初始化和實例化 KeyStore 物件所需的資訊。當調用 getKeyStore() 方法時觸發該過程。
這使將配置從 KeyStore 物件的創建中分離出來和(例如)在需要前一直延遲密碼提示成為可能。
KeyStore,
KeyStoreBuilderParameters| 建構子摘要 | |
|---|---|
protected |
KeyStore.Builder()
建構新的 Builder。 |
| 方法摘要 | |
|---|---|
abstract KeyStore |
getKeyStore()
返回此物件描述的 KeyStore。 |
abstract KeyStore.ProtectionParameter |
getProtectionParameter(String alias)
返回應該用來獲取具有給定別名的 Entry 的 ProtectionParameters。 |
static KeyStore.Builder |
newInstance(KeyStore keyStore,
KeyStore.ProtectionParameter protectionParameter)
返回封裝給定 KeyStore 的新 Builder。 |
static KeyStore.Builder |
newInstance(String type,
Provider provider,
File file,
KeyStore.ProtectionParameter protection)
返回新的 Builder 物件。 |
static KeyStore.Builder |
newInstance(String type,
Provider provider,
KeyStore.ProtectionParameter protection)
返回新的 Builder 物件。 |
| 從類別 java.lang.Object 繼承的方法 |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| 建構子詳細資訊 |
|---|
protected KeyStore.Builder()
| 方法詳細資訊 |
|---|
public abstract KeyStore getKeyStore()
throws KeyStoreException
KeyStoreException - 如果操作期間出現錯誤,例如,如果 KeyStore 不能被實例化或載入。
public abstract KeyStore.ProtectionParameter getProtectionParameter(String alias)
throws KeyStoreException
Entry 的 ProtectionParameters。在調用此方法前必須調用 getKeyStore 方法。
alias - KeyStore 項的別名
Entry 的 ProtectionParameters。
NullPointerException - 如果 alias 為 null
KeyStoreException - 如果操作期間發生錯誤
IllegalStateException - 如果調用此方法前沒有調用 getKeyStore 方法
public static KeyStore.Builder newInstance(KeyStore keyStore,
KeyStore.ProtectionParameter protectionParameter)
keyStore,getProtectionParameter() 方法將返回 protectionParameters。
如果一個現有的 KeyStore 物件需要和基於 Builder 的 APIs 一起使用,則此方法很有用。
keyStore - 將被封裝的 KeyStoreprotectionParameter - 用來保護 KeyStore 項的 ProtectionParameter
NullPointerException - 如果 keyStore 或 protectionParameters 為 null
IllegalArgumentException - 如果 keyStore 沒有被初始化
public static KeyStore.Builder newInstance(String type,
Provider provider,
File file,
KeyStore.ProtectionParameter protection)
第一次對返回的 builder 調用 getKeyStore() 方法將創建 type 型別的 KeyStore,並將調用其 load() 方法。inputStream 參數是根據 file 建構的。如果 protection 是 PasswordProtection,則通過調用 getPassword 方法獲取密碼。而如果 protection 是 CallbackHandlerProtection,則通過調用 CallbackHandler 獲取密碼。
對 getKeyStore() 的後續調用和初始調用返回相同的物件。如果初始調用失敗且拋出 KeyStoreException,則後續的調用也拋出 KeyStoreException。
根據 provider(如果非 null)初始化 KeyStore。否則,將搜尋所有安裝的提供者。
調用 getProtectionParameter() 將返回 PasswordProtection 物件,該物件封裝用來調用 load 方法的密碼。
注意,getKeyStore() 方法在調用此方法的程式碼的 AccessControlContext 中執行。
type - 將建構的 KeyStore 型別provider - 根據其實例化 KeyStore 提供者(或 null)file - 套件含 KeyStore 資料的 Fileprotection - 保護 KeyStore 資料的 ProtectionParameter
NullPointerException - 如果 type、file 或 protection 為 null
IllegalArgumentException - 如果 protection 既不是 PasswordProtection 也不是 CallbackHandlerProtection 的實例;如果 file 不存在或其不表示一個標準檔案
public static KeyStore.Builder newInstance(String type,
Provider provider,
KeyStore.ProtectionParameter protection)
每次對返回的 builder 調用 getKeyStore() 方法將返回新的 type 型別的 KeyStore 物件。使用封裝 protection 的 LoadStoreParameter 調用其 load() 方法。
根據 provider(如果非 null)初始化 KeyStore。否則,將搜尋所有安裝的提供者。
調用 getProtectionParameter() 將返回 protection。
注意,getKeyStore() 方法在調用此方法的程式碼的 AccessControlContext 中執行。
type - 將建構的 KeyStore 型別provider - 根據其實例化 KeyStore 的提供者(或 null)protection - 保護 Keystore 的 ProtectionParameter
NullPointerException - 如果 type 或 protection 為 null
|
JavaTM 2 Platform Standard Ed. 6 |
|||||||||
| 上一個類別 下一個類別 | 框架 無框架 | |||||||||
| 摘要: 巢狀 | 欄位 | 建構子 | 方法 | 詳細資訊: 欄位 | 建構子 | 方法 | |||||||||
版權所有 2008 Sun Microsystems, Inc. 保留所有權利。請遵守GNU General Public License, version 2 only。