리비싱 문제 #1 해답 결과 화일
참고서적) 리버스 엔지니어링 역분석 구조와 원리
otl_stream o;
try{
o.open(1, // buffer size should be equal to 1 in case of stored procedure call
"begin PROC_CERT_VALIDATION(:V_DN<char[4000],in>,:V_CERTSTAT<char[33],out> ); end;",
dbconn// connect object
);
o.set_commit(0);
o<<pszDN;
char pszStat[32];
o>>pszStat;
if (memcmp(pszStat,"GOOD",4)==0) nResult=0;
else nResult = -1;
o.close();
return 0;
}
catch( otl_exception &p )
{
///< intercept OTL exceptions
printf("%s",p.msg);
}
// failed
o.close();
CREATE OR REPLACE PROCEDURE GCAUSER.PROC_CERT_VALIDATION(V_DN IN VARCHAR,V_CERTSTAT OUT VARCHAR) AS
/******************************************************************************
NAME: PROC_CERT_VALIDATION
PURPOSE: 인증서를 경로 풀검증
REVISIONS:
Ver Date Author Description
--------- ---------- --------------- ------------------------------------
0.5 2010-04-23 강혁 1.인증서검증
******************************************************************************/
v_issuerdn VARCHAR2(500);
v_dnloop VARCHAR2(500);
v_stat VARCHAR2(32);qui
v_loop NUMBER;
BEGIN
SELECT ISSUERDN,STAT into v_issuerdn ,v_stat
FROM PKIENTITYPKC
WHERE DN=V_DN;
--PRINT :v_stat;
IF v_stat!='GOOD' THEN
BEGIN
V_CERTSTAT := v_stat;
RETURN;
END;
END IF;
v_loop := 1;
IF v_stat='GOOD' THEN
BEGIN
WHILE v_loop=1 LOOP
BEGIN
SELECT ISSUERDN,STAT,DN into v_issuerdn ,v_stat,v_dnloop
FROM A A,B B
WHERE B.DN=v_issuerdn AND B.SID=A.ASID;
IF v_stat!='GOOD' THEN
BEGIN
V_CERTSTAT := 'FAIL';
RETURN;
END;
END IF;
IF v_issuerdn=v_dnloop THEN
BEGIN
IF v_stat!='GOOD' THEN
BEGIN
V_CERTSTAT := 'FAIL';
RETURN;
END;
ELSE
BEGIN
V_CERTSTAT := v_stat;
v_loop := 0;
RETURN;
END;
END IF;
END;
END IF;
END;
END LOOP;
END;
END IF;
/*EXCEPTION
WHEN NO_DATA_FOUND THEN
NULL;
WHEN OTHERS THEN
RAISE;*/
END PROC_CERT_VALIDATION;
/
===========================================================================
sqlplus 에 접속해서
variable KKK VARCHAR2(32);
EXECUTE PROC_CERT_VALIDATION('인증서 DN값',:KKK);
print kkk
차례대로 입력한뒤 하면 결과값이 GOOD 또는 FAIL이 나오는 프로시져