to.tetramorph.starbase.dict
クラス CipherUtils

java.lang.Object
  上位を拡張 to.tetramorph.starbase.dict.CipherUtils

public class CipherUtils
extends Object

ドキュメントの暗号(というよりは難読化)を行う。


コンストラクタの概要
CipherUtils()
           
 
メソッドの概要
static byte[] decrypt(byte[] password, byte[] encryptedBytes)
          テキストを複合化する。
static byte[] encrypt(byte[] password, byte[] text)
          テキストを暗号化する。
static byte[] getBytes(String password)
          getStringで作成されたパスワードの16進数文字列を元のbyte配列に変換して返す。
static byte[] getDigest(String password)
          パスワード文字列からダイジェストを生成しbyte配列で返す。
static String getString(byte[] array)
          getDigestで作成したバイト配列を16進数文字列に変換して返す。
 
クラス java.lang.Object から継承されたメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

コンストラクタの詳細

CipherUtils

public CipherUtils()
メソッドの詳細

getString

public static String getString(byte[] array)
getDigestで作成したバイト配列を16進数文字列に変換して返す。 getDigestメソッドで作成したもの以外は考慮していない。

パラメータ:
array -

getBytes

public static byte[] getBytes(String password)
getStringで作成されたパスワードの16進数文字列を元のbyte配列に変換して返す。


getDigest

public static byte[] getDigest(String password)
パスワード文字列からダイジェストを生成しbyte配列で返す。 これはパスワードをハッシュするための関数で、 MD5のアルゴリズムでハッシュされた値を返す。


encrypt

public static byte[] encrypt(byte[] password,
                             byte[] text)
                      throws NoSuchAlgorithmException,
                             NoSuchPaddingException,
                             InvalidKeyException,
                             IllegalBlockSizeException,
                             BadPaddingException
テキストを暗号化する。

パラメータ:
password - 復号化のときに使用するパスワード
text - 暗号化したいテキスト。
戻り値:
暗号化されたテキストを格納したbyte配列。文字コードセットはUTF-8 である。
例外:
NoSuchAlgorithmException
NoSuchPaddingException
InvalidKeyException
IllegalBlockSizeException
BadPaddingException

decrypt

public static byte[] decrypt(byte[] password,
                             byte[] encryptedBytes)
                      throws NoSuchAlgorithmException,
                             NoSuchPaddingException,
                             InvalidKeyException,
                             IllegalBlockSizeException,
                             BadPaddingException
テキストを複合化する。

パラメータ:
password - パスワード
encryptedBytes - 暗号化されている文字配列
戻り値:
復号か化されたバイト文字配列
例外:
NoSuchAlgorithmException
NoSuchPaddingException
InvalidKeyException
IllegalBlockSizeException
BadPaddingException