public abstract static class KeyStore.Builder extends Object
このクラスのインスタンスは、KeyStore オブジェクトのインスタンス化と初期化に必要な情報をカプセル化します。getKeyStore() メソッドを呼び出すと、この処理が起動されます。
これにより、KeyStore オブジェクト作成から構成を分離することができ、必要になるまでパスワードプロンプトを遅延化させることなどが可能となります。
KeyStore, KeyStoreBuilderParameters| 修飾子 | コンストラクタと説明 |
|---|---|
protected |
KeyStore.Builder()
新しい Builder を構築します。
|
| 修飾子と型 | メソッドと説明 |
|---|---|
abstract KeyStore |
getKeyStore()
このオブジェクトが記述する KeyStore を返します。
|
abstract KeyStore.ProtectionParameter |
getProtectionParameter(String alias)
指定された別名の
Entry を取得する際に使用すべき ProtectionParameter を返します。 |
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 オブジェクトを返します。
|
public abstract KeyStore getKeyStore() throws KeyStoreException
KeyStoreException - 処理中にエラーが発生した場合 (KeyStore のインスタンス化またはロードに失敗した場合など)public abstract KeyStore.ProtectionParameter getProtectionParameter(String alias) throws KeyStoreException
Entry を取得する際に使用すべき ProtectionParameter を返します。getKeyStore メソッドを呼び出したあとでないと、このメソッドを呼び出せません。alias - KeyStore エントリの別名Entry を取得する際に使用すべき ProtectionParameter。NullPointerException - alias が null である場合KeyStoreException - 処理中にエラーが発生した場合IllegalStateException - このメソッドを呼び出す前に getKeyStore メソッドを呼び出していない場合public static KeyStore.Builder newInstance(KeyStore keyStore, KeyStore.ProtectionParameter protectionParameter)
keyStore を返し、getProtectionParameter() メソッドは protectionParameters を戻します。
このメソッドは、Builder ベースの API で既存の KeyStore オブジェクトを使用する必要がある場合に便利です。
keyStore - カプセル化する KeyStoreprotectionParameter - KeyStore エントリの保護に使用する ProtectionParameterNullPointerException - keyStore または protectionParameter のいずれかが null である場合IllegalArgumentException - keyStore が初期化されていない場合public static KeyStore.Builder newInstance(String type, Provider provider, File file, KeyStore.ProtectionParameter protection)
返されたビルダー上での初回の getKeyStore() メソッドの呼び出しでは、type 型の KeyStore が作成され、その load() メソッドが呼び出されます。inputStream 引数は file に基づいて構築されます。protection が PasswordProtection である場合、パスワードを取得するには getPassword メソッドを呼び出します。protection が CallbackHandlerProtection である場合、パスワードを取得するには CallbackHandler を呼び出します。
後続の getKeyStore() 呼び出しでは、初回の呼び出し時と同じオブジェクトが返されます。初回の呼び出しが KeyStoreException で失敗した場合、後続の呼び出しでも KeyStoreException がスローされます。
provider が null でない場合、そのプロバイダから KeyStore がインスタンス化されます。そうでない場合は、インストールされたすべてのプロバイダが検索されます。
getProtectionParameter() を呼び出すと、load メソッドの呼び出し時に使用されたパスワードをカプセル化した PasswordProtection オブジェクトが返されます。
getKeyStore() メソッドは、このメソッドを呼び出しているコードの AccessControlContext 内で実行されることに注意してください。
type - 構築する KeyStore の型provider - KeyStore をインスタンス化する際の基となるプロバイダまたは nullfile - KeyStore データが格納された Fileprotection - KeyStore データを保護する ProtectionParameterNullPointerException - type、file、またはprotection のいずれかが null である場合IllegalArgumentException - protection が PasswordProtection、CallbackHandlerProtection のどちらのインスタンスでもない場合、または file が存在しないか、通常のファイルを参照していない場合public static KeyStore.Builder newInstance(String type, Provider provider, KeyStore.ProtectionParameter protection)
返されたビルダー上で getKeyStore() メソッドを呼び出すたびに、型 type の新しい KeyStore オブジェクトが返されます。その load() メソッドは、protection をカプセル化した LoadStoreParameter を使用して呼び出されます。
provider が null でない場合、そのプロバイダから KeyStore がインスタンス化されます。そうでない場合は、インストールされたすべてのプロバイダが検索されます。
getProtectionParameter() を呼び出すと、protection を返します。
getKeyStore() メソッドは、このメソッドを呼び出しているコードの AccessControlContext 内で実行されることに注意してください。
type - 構築する KeyStore の型provider - KeyStore をインスタンス化する際の基となるプロバイダまたは nullprotection - キーストアを保護する ProtectionParameterNullPointerException - type、protection のいずれかが null である場合 バグまたは機能を送信
詳細な API リファレンスおよび開発者ドキュメントについては、Java SE のドキュメントを参照してください。そのドキュメントには、概念的な概要、用語の定義、回避方法、有効なコード例などの、開発者を対象にしたより詳細な説明が含まれています。
Copyright © 1993, 2013, Oracle and/or its affiliates. All rights reserved.