개발/classic asp
asp 에서 capicom.dll 을 이용하여 암호화 하고 복호화 하기
마스타
2014. 2. 25. 23:30
300x250
ㅁ ASP 에서 문자열 암호화와 복호화
이 기능을 사용하기 위해서는 다음에서 제공하는 capicom.dll 을 서버에 등록을 해야 한다.
http://www.microsoft.com/ko-kr/download/details.aspx?id=25281
<%
'==== CAPICOM
'== 이 기능을 위해서는 http://www.microsoft.com/ko-kr/download/details.aspx?id=25281 에서 제공하는 capicom.dll 을 등록해야 한다.
Const gcKEY = "tistory"
Function Encrypt(Message)
Dim ed, key
key = gcKEY
Set ed = CreateObject("CAPICOM.EncryptedData")
ed.Content = Message
' ed.Algorithm.Name = 3 '3des 방식으로 암호화
ed.SetSecret key
Encrypt = ed.Encrypt
Set ed = Nothing
End Function
Function Decrypt(EncMessage)
Dim ed, key
key = gcKEY
Set ed = CreateObject("CAPICOM.EncryptedData")
ed.SetSecret key
ed.Decrypt EncMessage
Decrypt = ed.Content
Set ed = Nothing
End Function
%>
300x250