2013년 10월 15일 화요일

aes - java, actionscript(flex), javascript

0. AES 
Web Server/Client 간 암호화된 메시지를 전달하기 위하여 AES (Advanced Encryption Standard)를 사용하였습니다. 암호화 방법은 AES/ECB/PKCS5Padding을 기준으로 합니다.

Java, Javascript, Actionscript(FLEX) AES example download --> Click

1. JAVA
javax.crypto.*의 함수를 사용했습니다.

2. Actionscript
as3crypto라는 프로젝트 (https://code.google.com/p/as3crypto/)를 참고했습니다.
제가 첨부한 코드를 사용하기 위해서는 위 사이트에서 as3crypto.swc lib를 다운받아 프로젝트에 추가해야 합니다.

3. Javascript
crypto-js 프로젝트 (https://code.google.com/p/crypto-js/) 를 참고 했습니다.
For the key, when you pass a string, it's treated as a passphrase and used to derive an actual key and IV. Or you can pass a WordArray that represents the actual key. If you pass the actual key, you must also pass the actual IV.
주의하실 부분이 위 내용처럼 string을 key로 넣게 되면 자동 생성되기 때문에 고정된 key를 사용할 수 없게 됩니다.  그래서 아래 처럼 사용했습니다.
var key = CryptoJS.enc.Hex.parse('6b6579'); // "key"

댓글 없음:

댓글 쓰기