public abstract static class KeyStore.Builder extends Object
このクラスのインスタンスは、KeyStoreオブジェクトのインスタンス化と初期化に必要な情報をカプセル化します。 getKeyStore()メソッドを呼び出すと、この処理が起動されます。
これにより、KeyStoreオブジェクト作成から構成を分離することができ、必要になるまでパスワード・プロンプトを遅延化させることなどが可能となります。
KeyStore, KeyStoreBuilderParameters| 修飾子 | コンストラクタ | 説明 |
|---|---|---|
protected |
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
KeyStoreKeyStoreException - 処理中にエラーが発生した場合(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, 2025, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Documentation Redistribution Policyも参照してください。