|
||||||||||
| 前のクラス 次のクラス | フレームあり フレームなし | |||||||||
| 概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド | |||||||||
java.lang.Objectorg.seasar.util.crypto.CipherPoolUtil
public abstract class CipherPoolUtil
Cipherを扱うユーティリティです。
Cipher のインスタンスをプールします。基本的な使い方は次のようになります。
暗号化や複合化の情報を保持するCipherContextのインスタンスを定数として定義します。 CipherContext
の標準的な実装クラスとして CipherContextImplが用意されています (利用可能なアルゴリズムはCipher
のJavadoc等を参照してください)。
public static final CipherContext BLOWFISH_CONTEXT =
new CipherContextImpl("Blowfish", "hogefuga");
Cipherは初期化にコストがかかるので、CipherPoolUtilはCipherContext
のインスタンスをプールします。 あらかじめインスタンスをプールしておくにはcreate(CipherContext, int)
メソッドを使います。
CipherPoolUtil.create(BLOWFISH_CONTEXT, 5);
文字列を暗号化するにはencryptoText(CipherContext, String, String)を使います。
String encryptoText =
CipherPoolUtil.encryptoText(BLOWFISH_CONTEXT, "パスワード", "UTF-8");
文字列を復号化するにはdecryptoText(CipherContext, String, String)を使います。
String decryptoText1 =
CipherPoolUtil
.decryptoText(BLOWFISH_CONTEXT, encryptoText1, "UTF-8");
| フィールドの概要 | |
|---|---|
protected static ConcurrentMap<String,Queue<Cipher>> |
decryptoQueueMap
decrypto用のCipherプール |
protected static ConcurrentMap<String,Queue<Cipher>> |
encryptoQueueMap
encrypto用のCipherプール |
| コンストラクタの概要 | |
|---|---|
CipherPoolUtil()
|
|
| メソッドの概要 | |
|---|---|
static void |
create(CipherContext context,
int size)
CipherContextのCipherインスタンスを事前にプールします。 |
static byte[] |
decrypto(CipherContext context,
byte[] data)
CipherContextのCipherでバイト配列を復号化します。 |
static String |
decryptoText(CipherContext context,
String text,
String charsetName)
CipherContextのCipherで文字列を暗号化します。 |
static byte[] |
encrypto(CipherContext context,
byte[] data)
CipherContextのCipherでバイト配列を暗号化します。 |
static String |
encryptoText(CipherContext context,
String text,
String charsetName)
CipherContextのCipherで文字列を暗号化します。 |
| クラス java.lang.Object から継承されたメソッド |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| フィールドの詳細 |
|---|
protected static final ConcurrentMap<String,Queue<Cipher>> encryptoQueueMap
protected static final ConcurrentMap<String,Queue<Cipher>> decryptoQueueMap
| コンストラクタの詳細 |
|---|
public CipherPoolUtil()
| メソッドの詳細 |
|---|
public static void create(CipherContext context,
int size)
CipherContextのCipherインスタンスを事前にプールします。
context - 生成するCipherContextsize - 生成するCipherインスタンス数
public static byte[] encrypto(CipherContext context,
byte[] data)
CipherContextのCipherでバイト配列を暗号化します。
context - 利用するCipherContextdata - 暗号化するバイト配列
public static String encryptoText(CipherContext context,
String text,
String charsetName)
CipherContextのCipherで文字列を暗号化します。
context - 利用するCipherContexttext - 暗号化する文字列charsetName - エンコーディング名
public static byte[] decrypto(CipherContext context,
byte[] data)
CipherContextのCipherでバイト配列を復号化します。
context - 利用するCipherContextdata - 復号化するバイト配列
public static String decryptoText(CipherContext context,
String text,
String charsetName)
CipherContextのCipherで文字列を暗号化します。
context - 利用するCipherContexttext - 復号化する文字列charsetName - エンコーディング名
|
||||||||||
| 前のクラス 次のクラス | フレームあり フレームなし | |||||||||
| 概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド | |||||||||