Files
poll-recruit/Recruit/Identification/phoneIdentityVerificationProc.asp

139 lines
4.8 KiB
Plaintext

<!-- #include file = "class.CryptSHA256.asp" -->
<%
DIM Resultcd : Resultcd = Request("Resultcd") '0000: 인증성공
DIM Resultmsg : Resultmsg = Request("Resultmsg") '결과메시지:한글(euc-kr)(평문)
DIM Mobilid : Mobilid = Request("Mobilid") '모빌리언스 거래번호
DIM Signdate : Signdate = Request("Signdate") '거래일자
DIM Svcid : Svcid = Request("Svcid") '서비스아이디
DIM Tradeid : Tradeid = Request("Tradeid") '가맹점 거래번호
DIM MSTR : MSTR = Request("MSTR") '가맹점 전달 콜백변수
DIM Name : Name = Request("Name") '이름:한글(euc-kr)(암호문)
DIM No : No = Request("No") '휴대폰번호(암호문)
DIM Commid : Commid = Request("Commid") '통신사(암호문)
DIM Socialno : Socialno = Request("Socialno") '생년월일(암호문)
DIM Sex : Sex = Request("Sex") '성별(암호문)
DIM Foreigner : Foreigner = Request("Foreigner") '외국인여부(암호문)
DIM Ci : Ci = Request("Ci") 'CI(암호문)
DIM Di : Di = Request("Di") 'DI(암호문)
DIM CI_Mode : CI_Mode = Request("CI_Mode") '인증요청구분
DIM DI_Mode : DI_Mode = Request("DI_Mode") '웹사이트코드
DIM Mac : Mac = Request("Mac") '위변조검증용
'DLL 설치해야 함
Set McashCipher = Server.CreateObject("McashCipher.Confirm.1")
Dim keygb0, keygb1, cryptKey
keygb0 = "240226143538"
keygb1 = "KriPol24"
cryptKey = Left(keygb1, 8) & Left(keygb0, 8)
'cryptKey = "KriPol2424022614"
McashCipher.TradeId = cryptKey
McashCipher.InputData = Resultcd
retval = McashCipher.decodeString
Resultcd = McashCipher.outputData
McashCipher.TradeId = cryptKey
McashCipher.InputData = Resultmsg
retval = McashCipher.decodeString
Resultmsg = McashCipher.outputData
McashCipher.TradeId = cryptKey
McashCipher.InputData = Mobilid
retval = McashCipher.decodeString
Mobilid = McashCipher.outputData
McashCipher.TradeId = cryptKey
McashCipher.InputData = Signdate
retval = McashCipher.decodeString
Signdate = McashCipher.outputData
McashCipher.TradeId = cryptKey
McashCipher.InputData = Svcid
retval = McashCipher.decodeString
Svcid = McashCipher.outputData
McashCipher.TradeId = cryptKey
McashCipher.InputData = Tradeid
retval = McashCipher.decodeString
Tradeid = McashCipher.outputData
McashCipher.TradeId = cryptKey
McashCipher.InputData = MSTR
retval = McashCipher.decodeString
MSTR = McashCipher.outputData
McashCipher.TradeId = cryptKey
McashCipher.InputData = Name
retval = McashCipher.decodeString
Name = McashCipher.outputData
McashCipher.TradeId = cryptKey
McashCipher.InputData = No
retval = McashCipher.decodeString
No = McashCipher.outputData
McashCipher.TradeId = cryptKey
McashCipher.InputData = Commid
retval = McashCipher.decodeString
Commid = McashCipher.outputData
McashCipher.TradeId = cryptKey
McashCipher.InputData = Socialno
retval = McashCipher.decodeString
Socialno = McashCipher.outputData
McashCipher.TradeId = cryptKey
McashCipher.InputData = Sex
retval = McashCipher.decodeString
Sex = McashCipher.outputData
McashCipher.TradeId = cryptKey
McashCipher.InputData = Foreigner
retval = McashCipher.decodeString
Foreigner = McashCipher.outputData
McashCipher.TradeId = cryptKey
McashCipher.InputData = Ci
retval = McashCipher.decodeString
Ci = McashCipher.outputData
McashCipher.TradeId = cryptKey
McashCipher.InputData = Di
retval = McashCipher.decodeString
Di = McashCipher.outputData
McashCipher.TradeId = cryptKey
McashCipher.InputData = CI_Mode
retval = McashCipher.decodeString
CI_Mode = McashCipher.outputData
McashCipher.TradeId = cryptKey
McashCipher.InputData = Di_Mode
retval = McashCipher.decodeString
Di_Mode = McashCipher.outputData
'####################################################################################
' Mac값 위변조 여부 확인
' : SHA256(Name + No + Socialno + Commid + Sex + Foreigner + Tradeid + Signdate + Di + Ci + Mobilid + cryptKey)
' Mac값과 SHA256으로 변환한 값을 비교하여 값이 불일치 할 경우 데이터 위·변조
'####################################################################################
Dim shastr, result, enStr
Set SHAObj = New CryptSHA256
enStr = Server.UrlEncode(Name & No & Socialno & Commid & Sex & Foreigner)
shastr = SHAObj.SHA256(enStr & Tradeid & Signdate & Di & Ci & Mobilid & cryptKey)
If StrComp(Mac, shastr, 0) = 0 Then
result = "SUCCESS"
Else
result = "FAIL"
End If
Response.write result
%>