クラスKeyStore.Builder
- 含まれているクラス:
KeyStore
KeyStoreオブジェクトの説明。
このクラスのインスタンスは、KeyStoreオブジェクトのインスタンス化と初期化に必要な情報をカプセル化します。 getKeyStore()メソッドを呼び出すと、この処理が起動されます。
これにより、KeyStoreオブジェクトの作成から構成を分離でき、パスワード・プロンプトが必要になるまで遅延します。
- 導入されたバージョン:
- 1.5
- 関連項目:
-
コンストラクタのサマリー
コンストラクタ -
メソッドのサマリー
修飾子と型メソッド説明abstract KeyStoreこのオブジェクトによって記述された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- 別名がnullの場合KeyStoreException- 処理中にエラーが発生した場合IllegalStateException- このメソッドをコールする前にgetKeyStoreメソッドが呼び出されていない場合
-
newInstance
public static KeyStore.Builder newInstance(KeyStore keyStore, KeyStore.ProtectionParameter protectionParameter) 指定されたKeyStoreをカプセル化する新しいBuilderを返します。 返されたオブジェクトのgetKeyStore()メソッドはkeyStoreを返し、getProtectionParameter()メソッドはprotectionParametersを戻します。これは、既存の
KeyStoreオブジェクトをビルダー・ベースのAPIとともに使用する必要がある場合に便利です。- パラメータ:
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をスローします。null以外の場合、
KeyStoreはproviderからインスタンス化されます。 そうでない場合は、インストールされたすべてのプロバイダが検索されます。getProtectionParameter()を呼び出すと、loadメソッドの呼出し時に使用されたパスワードをカプセル化したPasswordProtectionオブジェクトが返されます。- パラメータ:
type- 構築されるKeyStoreのタイプprovider-KeyStoreをインスタンス化するプロバイダ(またはnull)file-KeyStoreデータを含むファイルprotection-KeyStoreデータを保護するProtectionParameter- 戻り値:
- 新しい
Builderオブジェクト - スロー:
NullPointerException- タイプ、ファイルまたは保護が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オブジェクトが返されます。- パラメータ:
file-KeyStoreデータを含むファイルprotection-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を使用して呼び出されます。null以外の場合、
KeyStoreはproviderからインスタンス化されます。 そうでない場合は、インストールされたすべてのプロバイダが検索されます。getProtectionParameter()を呼び出すと、protectionを返します。- パラメータ:
type- 構築されるKeyStoreのタイプprovider-KeyStoreをインスタンス化するプロバイダ(またはnull)protection-Keystoreを保護するProtectionParameter- 戻り値:
- 新しい
Builderオブジェクト - スロー:
NullPointerException- タイプまたは保護がnullの場合
-