|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectkr.co.hit.live.security.codec.CipherHelper
public class CipherHelper
암호문 작성 관련 기능을 제공하는 유틸리티 클래스이다.
암호화/복호화를 하기 위한 암호키는 다음과 같은 방식으로 생성할 수 있다.
// RSA Asymmetric key
KeyPair keyPair = KeyPairGenerator.getInstance("RSA").generateKeyPair();
PublicKey pubKey = keyPair.getPublic();
PrivateKey priKey = keyPair.getPrivate();
// DES
SecretKey desKey = KeyGenerator.getInstance("DES").generateKey();
// Blowfish
SecretKey blowfishKey = KeyGenerator.getInstance("Blowfish").generateKey();
// Triple DES
SecretKey desedeKey = KeyGenerator.getInstance("DESede").generateKey();
| Constructor Summary | |
|---|---|
CipherHelper()
|
|
| Method Summary | |
|---|---|
static byte[] |
decode(String s,
long kk)
|
static byte[] |
decode(String s,
String kk)
암호화된 문자열을 원래 데이터로 복호화한다. |
static PrivateKey |
decodePrivateKey(byte[] encodedKey)
인코딩되어 있는 byte[]로부터 RSA용 개인키 객체를 가져온다. |
static PublicKey |
decodePublicKey(byte[] encodedKey)
인코딩되어 있는 byte[]로부터 RSA용 공개키 객체를 가져온다. |
static SecretKey |
decodeSecretKey(byte[] encodedKey,
String algorithm)
대칭키 방식용 키 객체를 생성한다. |
static byte[] |
decrypt(byte[] input,
Key key,
String algorithm)
주어진 key를 사용하여 암호문을 푼다. |
static String |
encode(byte[] b,
long kk)
|
static String |
encode(byte[] b,
String kk)
byte[]를 문자열을 자체 암호문으로 인코딩한다. |
static byte[] |
encode(Key key)
Key 객체를 byte[]로 반환한다. |
static String |
encode(String s,
long kk)
|
static String |
encode(String s,
String kk)
|
static byte[] |
encrypt(byte[] input,
Key key,
String algorithm)
주어진 key를 사용하여 평문을 암호화한다. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public CipherHelper()
| Method Detail |
|---|
public static byte[] encode(Key key)
key -
public static PrivateKey decodePrivateKey(byte[] encodedKey)
throws GeneralSecurityException
encodedKey -
GeneralSecurityException
public static PublicKey decodePublicKey(byte[] encodedKey)
throws GeneralSecurityException
encodedKey -
GeneralSecurityException
public static SecretKey decodeSecretKey(byte[] encodedKey,
String algorithm)
throws GeneralSecurityException
encodedKey - algorithm - 적용 알고리즘
GeneralSecurityException
public static byte[] encrypt(byte[] input,
Key key,
String algorithm)
throws GeneralSecurityException
input - key - algorithm -
GeneralSecurityException
public static byte[] decrypt(byte[] input,
Key key,
String algorithm)
throws GeneralSecurityException
input - key - algorithm -
GeneralSecurityException
public static String encode(byte[] b,
String kk)
b - kk - 암호키
public static String encode(byte[] b,
long kk)
public static String encode(String s,
String kk)
public static String encode(String s,
long kk)
public static byte[] decode(String s,
String kk)
s - kk -
public static byte[] decode(String s,
long kk)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||