クラスKeyStore.Builder

java.lang.Object
java.security.KeyStore.Builder
含まれているクラス:
KeyStore

public abstract static class KeyStore.Builder extends Object
インスタンス化予定のKeyStoreオブジェクトの説明。

このクラスのインスタンスは、KeyStoreオブジェクトのインスタンス化と初期化に必要な情報をカプセル化します。 getKeyStore()メソッドを呼び出すと、この処理が起動されます。

これにより、KeyStoreオブジェクトの作成から構成を分離でき、パスワード・プロンプトが必要になるまで遅延します。

導入されたバージョン:
1.5
関連項目:
  • コンストラクタのサマリー

    コンストラクタ
    修飾子
    コンストラクタ
    説明
    protected
    新しいBuilderを作成します。
  • メソッドのサマリー

    修飾子と型
    メソッド
    説明
    abstract KeyStore
    このオブジェクトによって記述されたKeyStoreを返します。
    指定された別名でEntryを取得するために使用する必要があるProtectionParameterを返します。
    新しいBuilderオブジェクトを返します。
    newInstance(String type, Provider provider, File file, KeyStore.ProtectionParameter protection)
    新しいBuilderオブジェクトを返します。
    新しいBuilderオブジェクトを返します。
    newInstance(KeyStore keyStore, KeyStore.ProtectionParameter protectionParameter)
    指定されたKeyStoreをカプセル化する新しいBuilderを返します。

    クラスオブジェクトで宣言されたメソッド

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    修飾子と型
    メソッド
    説明
    protected Object
    このオブジェクトのコピーを作成して、返します。
    boolean
    このオブジェクトと他のオブジェクトが等しいかどうかを示します。
    protected void
    削除予定のため非推奨: このAPI要素は、将来のバージョンで削除される可能性があります。
    最終決定は非推奨であり、将来のリリースで削除される可能性があります。
    final Class<?>
    このObjectの実行時クラスを返します。
    int
    このオブジェクトに対するハッシュ・コード値を返します。
    final void
    このオブジェクトのモニターで待機中のスレッドを1つ再開します。
    final void
    このオブジェクトのモニターで待機中のすべてのスレッドを再開します。
    オブジェクトの文字列表現を返します。
    final void
    現在のスレッドが目覚めるまで待機します。通常、notifiedまたはinterruptedです。
    final void
    wait(long timeoutMillis)
    現在のスレッドは、通常、notifiedまたはinterruptedであるか、一定のリアルタイムが経過するまで、目覚めるまで待機します。
    final void
    wait(long timeoutMillis, int nanos)
    現在のスレッドは、通常、notifiedまたはinterruptedであるか、一定のリアルタイムが経過するまで、目覚めるまで待機します。
  • コンストラクタの詳細

    • 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 - カプセル化するKeyStore
      protectionParameter - KeyStoreエントリを保護するために使用されるProtectionParameter
      戻り値:
      新しいBuilderオブジェクト
      スロー:
      NullPointerException - keyStoreまたはprotectionParameternullの場合
      IllegalArgumentException - keyStoreが初期化されていない場合
    • newInstance

      public static KeyStore.Builder newInstance(String type, Provider provider, File file, KeyStore.ProtectionParameter protection)
      新しいBuilderオブジェクトを返します。

      戻されたビルダーでgetKeyStore()メソッドの最初のコールでは、type型のKeyStoreが作成され、そのload()メソッドがコールされます。 inputStream引数はfileに基づいて構築されます。 protectionPasswordProtectionである場合、パスワードを取得するにはgetPasswordメソッドを呼び出します。 protectionCallbackHandlerProtectionである場合、パスワードを取得するにはCallbackHandlerを呼び出します。

      後続のgetKeyStore()呼出しでは、初回の呼出し時と同じオブジェクトが返されます。 最初の呼び出しがKeyStoreExceptionで失敗した場合、後続の呼び出しもKeyStoreExceptionをスローします。

      null以外の場合、KeyStoreproviderからインスタンス化されます。 そうでない場合は、インストールされたすべてのプロバイダが検索されます。

      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に基づいて構築されます。 protectionPasswordProtectionである場合、パスワードを取得するにはgetPasswordメソッドを呼び出します。 protectionCallbackHandlerProtectionである場合、パスワードを取得するには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以外の場合、KeyStoreproviderからインスタンス化されます。 そうでない場合は、インストールされたすべてのプロバイダが検索されます。

      getProtectionParameter()を呼び出すと、protectionを返します。

      パラメータ:
      type - 構築されるKeyStoreのタイプ
      provider - KeyStoreをインスタンス化するプロバイダ(またはnull)
      protection - Keystoreを保護するProtectionParameter
      戻り値:
      新しいBuilderオブジェクト
      スロー:
      NullPointerException - タイプまたは保護がnullの場合