public class AesEncryptor extends java.lang.Object implements Encryptor<AesEncryptor.AesContext>
| Modifier and Type | Class and Description | 
|---|---|
static class  | 
AesEncryptor.AesContext
AES暗号のコンテキスト情報を保持するクラス。 
 | 
| Constructor and Description | 
|---|
AesEncryptor()  | 
| Modifier and Type | Method and Description | 
|---|---|
byte[] | 
decrypt(AesEncryptor.AesContext context,
       byte[] src)
コンテキスト情報を使用して復号を行う。 
 | 
byte[] | 
encrypt(AesEncryptor.AesContext context,
       byte[] src)
コンテキスト情報を使用して暗号化を行う。 
 | 
AesEncryptor.AesContext | 
generateContext()
暗号化と復号に使用するコンテキスト情報を生成する。 
コンテキスト情報には、共通鍵暗号方式であれば使用する共通鍵を保持する。  | 
protected byte[] | 
generateIv(int length)
IV(イニシャルバリュー)を生成する。 
 | 
protected java.security.Key | 
generateKey(int length)
共通鍵を生成する。 
 | 
protected byte[] | 
getBytes(java.lang.String text)
共通鍵又はIV(イニシャルバリュー)の文字列からバイト配列を取得する。
 
 デフォルト実装では"UTF-8"で符号化する。 
 | 
void | 
setBase64Key(Base64Key base64Key)
暗号化に使用する128bitの共通鍵及びIVをBase64エンコードした値を設定する。 
 | 
void | 
setIv(java.lang.String iv)
Deprecated. 
 
本メソッドはIVに文字列しか指定できないため、使用できる値に制限があり脆弱である。このため 
setBase64Key(Base64Key)を使用すること。 | 
void | 
setKey(java.lang.String key)
Deprecated. 
 
本メソッドは共通鍵に文字列しか指定できないため、使用できる値に制限があり脆弱である。このため 
setBase64Key(Base64Key)を使用すること。 | 
@Deprecated public void setKey(java.lang.String key)
setBase64Key(Base64Key)を使用すること。key - 暗号化に使用する共通鍵(128bit)public void setBase64Key(Base64Key base64Key)
base64Key - 暗号化に使用する鍵@Deprecated public void setIv(java.lang.String iv)
setBase64Key(Base64Key)を使用すること。iv - 暗号化に使用するIV(イニシャルバリュー)(128bit)public AesEncryptor.AesContext generateContext()
generateContext in interface Encryptor<AesEncryptor.AesContext>public byte[] encrypt(AesEncryptor.AesContext context, byte[] src)
Encryptorencrypt in interface Encryptor<AesEncryptor.AesContext>context - コンテキスト情報src - 暗号元public byte[] decrypt(AesEncryptor.AesContext context, byte[] src)
Encryptordecrypt in interface Encryptor<AesEncryptor.AesContext>context - コンテキスト情報src - 復号元protected byte[] getBytes(java.lang.String text)
text - 共通鍵又はIV(イニシャルバリュー)の文字列protected java.security.Key generateKey(int length)
length - 鍵長(bit)protected byte[] generateIv(int length)
length - 鍵長(bit)