カスタム・パスワード暗号化のプラグ・ポイント
カスタム・パスワード暗号化のプラグ・ポイントを作成すると、WebSphere® Application Server で現在 Base64 エンコードを使用してエンコードまたはデコードしているすべてのパスワードを暗号化し、暗号化解除することができます。
このプラグ・ポイントの実装クラスは、 鍵の管理、使用する暗号化アルゴリズムの決定、および重要な秘密の保護を受け持ちます。 WebSphere Application Server ランタイムは、暗号化されたパスワードを既存の場所に保管します。その際、{xor} タグではなく、{custom:alias} タグが前に付きます。タグのカスタム部分は、それがカスタム・アルゴリズムであることを示しています。 タグの別名部分は、カスタム実装によって指定されます。 これは、パスワードの暗号化方法を示すのに役立ちます。 この実装には、鍵の別名、暗号化アルゴリズム、暗号化モード、または暗号化埋め込みが組み込まれています。
このプラグ・ポイントのカスタム・プロバイダーは、 パスワードを暗号化および暗号化解除するように設計されたインターフェースを実装する必要があります。 このインターフェースは、カスタム・プラグ・ポイントが使用可能にされるたびに、WebSphere Application Server ランタイムによって呼び出されます。カスタム・アルゴリズムは、プラグ・ポイントが使用可能化されると、 サポートされるアルゴリズムのうちの 1 つになります。 サポートされるその他のアルゴリズムには、{xor} (標準 Base64 エンコード) と、{os400} (iSeries プラットフォームで使用される) があります。
package com.ibm.wsspi.security.crypto;
public interface CustomPasswordEncryption
{
/**
* The encrypt operation takes a UTF-8 encoded String in the form of a byte[].
* The byte[] is generated from String.getBytes("UTF-8").
* An encrypted byte[] is returned from the implementation in the EncryptedInfo
* object.
Additionally, a logical key alias is returned in the EncryptedInfo
* objectwhich is passed back into the decrypt method to determine which key was
* used to encrypt this password. The WebSphere Application Server runtime has
* no knowledge of the algorithm or the key used to encrypt the data.
*
* @param byte[]
* @return com.ibm.wsspi.security.crypto.EncryptedInfo
* @throws com.ibm.wsspi.security.crypto.PasswordEncryptException
**/
public EncryptedInfo encrypt (byte[] decrypted_bytes) throws PasswordEncryptException;
/**
* The decrypt operation takes the EncryptedInfo object containing a byte[]
* and the logical key alias and converts it to the decrypted byte[]. The
* WebSphere Application Server runtime converts the byte[] to a String
* using new String (byte[], "UTF-8");
*
* @param com.ibm.wsspi.security.crypto.EncryptedInfo
* @return byte[]
* @throws com.ibm.wsspi.security.crypto.PasswordDecryptException
**/
public byte[] decrypt (EncryptedInfo info) throws PasswordDecryptException;
/**
* The following is reserved for future use and is currently not
* called by the WebSphere Application Server runtime.
*
* @param java.util.HashMap
**/
public void initialize (java.util.HashMap initialization_data);
}
package com.ibm.wsspi.security.crypto;
public class EncryptedInfo
{
private byte[] bytes;
private String alias;
/**
* This constructor takes the encrypted bytes and a keyAlias as parameters.
* This constructor is used to pass to or from the WebSphere Application Server
* runtime to enable the runtime to associate the bytes with a specific key that
* is used to encrypt the bytes.
*/
public EncryptedInfo (byte[] encryptedBytes, String keyAlias)
{
bytes = encryptedBytes;
alias = keyAlias;
}
/**
* This command returns the encrypted bytes.
*
* @return byte[]
*/
public byte[] getEncryptedBytes()
{
return bytes;
}
/**
* This command returns the key alias. The key alias is a logical string that is
* associated with the encrypted password in the model. The format is
* {custom:keyAlias}encrypted_password. Typically, just the key alias is placed
* here, but algorithm information can also be returned.
*
* @return String
*/
public String getKeyAlias()
{
return alias;
}
}
暗号化方式は、カスタム・クラスが構成され、カスタム暗号化が使用可能にされるごとに、 パスワード処理のために呼び出されます。 暗号化解除メソッドは、カスタム・クラスが構成され、パスワードに {custom:alias} タグが含まれている場合に呼び出されます。 custom:alias タグは、暗号化解除の前に除去されます。 詳しくは、カスタム・パスワード暗号化の使用可能化を参照してください。