<% '#################################################################################### '# 파일명 : okurl.asp '# 작성일 : 2025.08 '# 용 도 : 휴대폰본인확인 okurl 페이지 '# 버 전 : 0001 '#################################################################################### '#################################################################################### '# MAC값 위변조를 확인하기 위해 SHA256 변환이 필요합니다. '# 참고용으로 KISA 암호알고리즘 소스코드를 사용했으며, '# 해당 소스코드를 사용하여 한글이 깨질 경우 아래 인코딩 코드를 포함하시길 권장합니다. '#################################################################################### %> <% '#################################################################################### '#인증 성공시 웹 페이지 전환으로 호출되는 페이지이며 가맹점에서 구현해야하는 화면입니다. '# 암호화 사용시 필수 DLL '# McashCipher.dll '# '# asp 에서 dll 사용하기 위한 설정 '# cmd 창에서 C:\regsvr32 McashCipher.dll '#################################################################################### Dim Resultcd, Resultmsg, No, Name, Sex, Socialno, Tradeid, Svcid, Mobilid, Signdate, MSTR, Mac, key, shastr, result Resultcd = Request("Resultcd") ' 결과코드 Resultmsg = Request("Resultmsg") ' 결과메세지 No = Request("No") ' 휴대폰번호(암호문) Name = Request("Name") '이름:한글(euc-kr)(암호문) Sex = Request("Sex") '성별(암호문) Socialno = Request("Socialno") '생년월일(암호문) Tradeid = Request("Tradeid") ' 상점거래번호 Svcid = Request("Svcid") ' 서비스아이디 Mobilid = Request("Mobilid") ' 모빌리언스 거래번호 Signdate = Request("Signdate") ' 결제일자 MSTR = Request("MSTR") ' 가맹점 전달 콜백변수 Mac = Request("Mac") ' 검증키 '#################################################################################### ' 데이터 복호화 ' 주) 고유KEY 설정 시 비밀키 : "가맹점 고유 KEY + CI_SVCID 앞 8자리" (16byte) // Keygb 1 or 2 '#################################################################################### ' ### 암호화 오브젝트 생성 ### Set McashCipher = Server.CreateObject("McashCipher.Confirm.1") Dim keygb, keygb1, keygb2, cryptKey keygb = "1" '# 사용하는 고유 키 인덱스값 0 or 1 or 2 keygb0 = "240226143538" keygb1 = "KriPol24" cryptKey = Left(keygb1, 8) & Left(keygb0, 8) 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 = No retval = McashCipher.decodeString No = McashCipher.outputData McashCipher.TradeId = cryptKey McashCipher.InputData = Name retval = McashCipher.decodeString Name = McashCipher.outputData McashCipher.TradeId = cryptKey McashCipher.InputData = Sex retval = McashCipher.decodeString Sex = McashCipher.outputData McashCipher.TradeId = cryptKey McashCipher.InputData = Socialno retval = McashCipher.decodeString Socialno = McashCipher.outputData McashCipher.TradeId = cryptKey McashCipher.InputData = Tradeid retval = McashCipher.decodeString Tradeid = McashCipher.outputData McashCipher.TradeId = cryptKey McashCipher.InputData = Svcid retval = McashCipher.decodeString Svcid = 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 = MSTR retval = McashCipher.decodeString MSTR = McashCipher.outputData '#################################################################################### ' Mac값 위변조 여부 확인 SHA256(Tradeid + Svcid + Mobilid + Signdate + cryptKey) ' Mac값과 SHA256으로 변환한 값을 비교하여 값이 불일치 할 경우 데이터 위·변조 '#################################################################################### Set SHAObj = New CryptSHA256 shastr = SHAObj.SHA256(Tradeid & Svcid & Mobilid & Signdate & cryptKey) If StrComp(Mac, shastr, 0) = 0 Then result = "데이터가 정상입니다." Else result = "데이터가 위·변조되었습니다." End If '#################################################################################### ' 아래는 결과를 단순히 출력하는 샘플입니다. ' 가맹점에서는 부모창 전환등 스크립트 처리등을 하시면 됩니다. '#################################################################################### %> <% dim source source = Request.QueryString("source") %> KG모빌리언스