사용자 정의 비밀번호 암호화의 플러그 지점
사용자 정의 비밀번호 암호화의 플러그 지점은 Base64 인코딩을 사용하여 현재 암호화 또는 복호화되는 WebSphere® Application Server의 모든 비밀번호를 암호화 및 복호화하기 위해 작성 가능합니다.
이 플러그 지점의 구현 클래스는 관리하는 키에 대해 사용할 암호화 알고리즘을 판별하고 마스터 기밀을 보호해야 합니다. WebSphere Application Server 런타임은 암호화된 비밀번호를 기존 위치에 저장하며 {xor} 태그가 아니라 {custom:alias} 태그를 앞에 추가합니다. 태그의 custom 부분은 사용자 정의 알고리즘임을 표시합니다. 태그의 alias 부분은 비밀번호가 암호화되는 방법을 표시하는 데 도움이 되는 사용자 정의 구현에서 지정됩니다. 구현은 키 별명, 암호화 알고리즘, 암호화 모드 또는 암호화 채우기를 포함할 수 있습니다.
이 플러그 지점의 사용자 정의 제공자는 비밀번호를 암호화하고 복호화하도록 디자인된 인터페이스를 구현해야 합니다. 인터페이스는 사용자 정의 플러그 지점이 사용 가능할 때마다 WebSphere Application Server 런타임에서 호출됩니다. 사용자 정의 알고리즘은 플러그 지점이 사용 가능할 때 지원되는 알고리즘 중 하나가 됩니다. 지원되는 다른 알고리즘으로는 {xor}(표준 base64 인코딩)과 iSeries 플랫폼에 사용되는 {os400}이 있습니다.
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 태그는 복호화 이전에 제거됩니다. 자세한 정보는 사용자 정의 비밀번호 암호화 사용 가능을 참조하십시오.