- 含まれているクラス:
- KeyStore
public abstract static class KeyStore.Builder extends Object
このクラスのインスタンスは、KeyStoreオブジェクトのインスタンス化と初期化に必要な情報をカプセル化します。 getKeyStore()メソッドを呼び出すと、この処理が起動されます。
これにより、KeyStoreオブジェクト作成から構成を分離することができ、必要になるまでパスワード・プロンプトを遅延化させることなどが可能となります。
- 導入されたバージョン:
- 1.5
- 関連項目:
KeyStore,KeyStoreBuilderParameters
-
コンストラクタのサマリー
コンストラクタ 修飾子 コンストラクタ 説明 protectedBuilder()新しいBuilderを構築します。 -
メソッドのサマリー
修飾子と型 メソッド 説明 abstract KeyStoregetKeyStore()このオブジェクトが記述するKeyStoreを返します。abstract KeyStore.ProtectionParametergetProtectionParameter(String alias)指定された別名のEntryを取得する際に使用すべきProtectionParameterを返します。static KeyStore.BuildernewInstance(File file, KeyStore.ProtectionParameter protection)新しいBuilderオブジェクトを返します。static KeyStore.BuildernewInstance(String type, Provider provider, File file, KeyStore.ProtectionParameter protection)新しいBuilderオブジェクトを返します。static KeyStore.BuildernewInstance(String type, Provider provider, KeyStore.ProtectionParameter protection)新しいBuilderオブジェクトを返します。static KeyStore.BuildernewInstance(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である場合
-