1 2 2 Salt Iteration Base 64 PBEKey
이 장에서 다룰 내용 1 2 2 Salt 알고리즘 Iteration Base 64 PBEKey. Spec Secret. Key. Factory PBEParameter. Spec PBE 예제 Count이름과 제공자 3 2 4 2 5 2 6 2 7 2 8 2 2
Secret. Key. Factory PBEKey. Spec을 실제 키로 사용하기 위해서는 Secret. Key. Factory의 generate. Secret()와 함께 실행 시켜야 한다. Secret. Key. Factory key. Factory = Secret. Key. Factory. get. Instance(“PBEWith. MD 5 And. Des”); Secret. Key the. Key = key. Factory. generate. Secret(key. Spec); 7
PBEParameter. Spec PBE를 사용한 암호문을 생성하기 위해서는 salt와 iteration count를 인스턴스 생성시 암호문에 전달 해야 한다. PBEParameter. Spec는 salt와 iteration count를 위한 객체이다. 이것은 키와 함께 암호문에게 전달된다. salt와 iteration이미 정의 되어 있다고 가정하면 다음과 같이 암호문을 얻을수 있다. PBEParameter. Spec param. Spec = new PBEParameter. Spec(salt, iterations); Cipher cipher = Cipher. get. Instance(PBEWith. MD 5 And. Des); cipher. init(Cipher. ENCRYT_MODE, the. Key, param. Spec); 8
예제 실행방법 : c: ₩> java PBE –e sasquatch “Hello java Security” 결과 : dfjla/=40 u 35 dak 34 pt=kfkl c: ₩> java PBE –d sasquatch “dfjla/=40 u 35 dak 34 pt=kfkl” 10
- Slides: 11