- 含まれているクラス:
- KeyStore
public abstract static class KeyStore.Builder extends Object
このクラスのインスタンスは、KeyStoreオブジェクトのインスタンス化と初期化に必要な情報をカプセル化します。 getKeyStore()メソッドを呼び出すと、この処理が起動されます。
これにより、KeyStoreオブジェクト作成から構成を分離することができ、必要になるまでパスワード・プロンプトを遅延化させることなどが可能となります。
- 導入されたバージョン:
- 1.5
- 関連項目:
KeyStore
,KeyStoreBuilderParameters
-
コンストラクタのサマリー
コンストラクタ 修飾子 コンストラクタ 説明 protected
Builder()
新しいBuilderを構築します。 -
メソッドのサマリー
修飾子と型 メソッド 説明 abstract KeyStore
getKeyStore()
このオブジェクトが記述するKeyStoreを返します。abstract KeyStore.ProtectionParameter
getProtectionParameter(String alias)
指定された別名のEntry
を取得する際に使用すべきProtectionParameterを返します。static KeyStore.Builder
newInstance(File file, KeyStore.ProtectionParameter protection)
新しい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オブジェクトを返します。static KeyStore.Builder
newInstance(KeyStore keyStore, KeyStore.ProtectionParameter protectionParameter)
指定されたKeyStoreをカプセル化する新しいBuilderを返します。
-
コンストラクタの詳細
-
Builder
protected Builder()新しいBuilderを構築します。
-
-
メソッドの詳細
-
getKeyStore
public abstract KeyStore getKeyStore() throws KeyStoreExceptionこのオブジェクトが記述するKeyStoreを返します。- 戻り値:
- このオブジェクトが記述する
KeyStore
- 例外:
KeyStoreException
- 処理中にエラーが発生した場合(KeyStoreのインスタンス化またはロードに失敗した場合など)
-
getProtectionParameter
public abstract KeyStore.ProtectionParameter getProtectionParameter(String alias) throws KeyStoreException指定された別名のEntry
を取得する際に使用すべきProtectionParameterを返します。getKeyStore
メソッドを呼び出したあとでないと、このメソッドを呼び出せません。- パラメータ:
alias
- KeyStoreエントリの別名- 戻り値:
- 指定された別名の
Entry
を取得する際に使用すべきProtectionParameter。 - 例外:
NullPointerException
- aliasがnullである場合KeyStoreException
- 処理中にエラーが発生した場合IllegalStateException
- このメソッドを呼び出す前にgetKeyStoreメソッドを呼び出していない場合
-
newInstance
public static KeyStore.Builder newInstance(KeyStore keyStore, KeyStore.ProtectionParameter protectionParameter)指定されたKeyStoreをカプセル化する新しいBuilderを返します。 返されたオブジェクトのgetKeyStore()メソッドはkeyStore
を返し、getProtectionParameter()メソッドはprotectionParameters
を戻します。このメソッドは、BuilderベースのAPIで既存のKeyStoreオブジェクトを使用する必要がある場合に便利です。
- パラメータ:
keyStore
- カプセル化するKeyStoreprotectionParameter
- KeyStoreエントリの保護に使用するProtectionParameter- 戻り値:
- 新しいBuilderオブジェクト
- 例外:
NullPointerException
- keyStoreまたはprotectionParameterのいずれかがnullである場合IllegalArgumentException
- keyStoreが初期化されていない場合
-
newInstance
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()
を呼び出すと、load
メソッドの呼出し時に使用されたパスワードをカプセル化したPasswordProtection
オブジェクトが返されます。getKeyStore()
メソッドは、このメソッドを呼び出しているコードのAccessControlContext
内で実行されることに注意してください。- パラメータ:
type
- 構築するKeyStoreの型provider
- KeyStoreをインスタンス化する際の基となるプロバイダまたはnullfile
- KeyStoreデータが格納されたFileprotection
- KeyStoreデータを保護するProtectionParameter- 戻り値:
- 新しいBuilderオブジェクト
- 例外:
NullPointerException
- type、file、またはprotectionのいずれかがnullである場合IllegalArgumentException
- protectionがPasswordProtection、CallbackHandlerProtectionのどちらのインスタンスでもない場合、またはfileが存在しないか、通常のファイルを参照していない場合
-
newInstance
public static KeyStore.Builder newInstance(File file, KeyStore.ProtectionParameter protection)新しいBuilderオブジェクトを返します。返されたビルダーの
getKeyStore()
メソッドへの最初の呼び出しでは、file
を使用してKeyStoreを作成し、キーストア型を検出してからload()
メソッドを呼び出します。KeyStore.getInstance(File, LoadStoreParameter)
で説明されているように、同じアルゴリズムを使用してキーストアの型を判別します。inputStream
引数はfile
に基づいて構築されます。protection
がPasswordProtection
である場合、パスワードを取得するにはgetPassword
メソッドを呼び出します。protection
がCallbackHandlerProtection
である場合、パスワードを取得するにはCallbackHandlerを呼び出します。後続の
getKeyStore()
呼出しでは、初回の呼出し時と同じオブジェクトが返されます。 KeyStoreExceptionで初期呼び出しが失敗した場合、後続の呼び出しもKeyStoreExceptionをスローします。getProtectionParameter()
を呼び出すと、load
メソッドの呼出し時に使用されたパスワードをカプセル化したPasswordProtection
オブジェクトが返されます。getKeyStore()
メソッドは、このメソッドを呼び出しているコードのAccessControlContext
内で実行されることに注意してください。- パラメータ:
file
- KeyStoreデータが格納されたFileprotection
- KeyStoreデータを保護するProtectionParameter- 戻り値:
- 新しいBuilderオブジェクト
- 例外:
NullPointerException
- ファイルまたは保護がnullの場合IllegalArgumentException
- protectionがPasswordProtection、CallbackHandlerProtectionのどちらのインスタンスでもない場合、またはfileが存在しないか、通常のファイルを参照していない場合- 導入されたバージョン:
- 9
-
newInstance
public static KeyStore.Builder newInstance(String type, Provider provider, KeyStore.ProtectionParameter protection)新しいBuilderオブジェクトを返します。返されたビルダー上で
getKeyStore()
メソッドを呼び出すたびに、型type
の新しいKeyStoreオブジェクトが返されます。 そのload()
メソッドは、protection
をカプセル化したLoadStoreParameter
を使用して呼び出されます。provider
がnullでない場合、そのプロバイダからKeyStoreがインスタンス化されます。 そうでない場合は、インストールされたすべてのプロバイダが検索されます。getProtectionParameter()
を呼び出すと、protection
を返します。getKeyStore()
メソッドは、このメソッドを呼び出しているコードのAccessControlContext
内で実行されることに注意してください。- パラメータ:
type
- 構築するKeyStoreの型provider
- KeyStoreをインスタンス化する際の基となるプロバイダまたはnullprotection
- キーストアを保護するProtectionParameter- 戻り値:
- 新しいBuilderオブジェクト
- 例外:
NullPointerException
- type、protectionのいずれかがnullである場合
-