//
// XecureWeb SSL Client Java Script ver4 2000.6.20
//
//
//history
//2001.2.1 - XecureNavigate_NoEnc,XecureNavigate,XecureSubmit : »ó´ëÆÐ½º ¿À·ù¼öÁ¤
/* Test yessign CA IP */
var ca_ip = "203.233.91.232";
/* Real yessign CA IP */
//var ca_ip = "203.233.91.71";
var ca_port = 4512;
var accept_cert = "yessign,Å×½ºÆ® ÀÎÁõ±â°ü";
// ¹Ýµå½Ã È£½ºÆ® ¸íÀ» ÁöÁ¤ÇÒ °Í
// var bannerUrl = "http://www.softforum.co.kr/XecureObject/xecure.bmp";
var bannerUrl = "";
var pCaCertUrl= "http://" + window.location.host + "/weblogic/XecureObject/signed_cacert.bin";
var pCaCertName = "Å×½ºÆ® ÀÎÁõ±â°ü";
// ÀüÀÚ¼¸í âÀÇ ¸Þ½ÃÁö
var sign_desc = "";
var show_plain = 1; // ÀüÀÚ¼¸í½Ã ¼¸í¿ø¹® â º¸±â ¿É¼Ç. 0 : ¼¸í¿ø¹® Ãâ·Â ¾ÈÇÔ, 1 : ¼¸í¿ø¹® Ãâ·Â
// xgate ¼¹ö ¸í:Æ÷Æ® ÁöÁ¤ , Æ÷Æ® »ý·«½Ã µðÆúÆ®·Î 443 Æ÷Æ® »ç¿ë
var xgate_addr = window.location.hostname + ":443:8080";
var packageURL = 'http://' + window.location.host + '/weblogic/XecureObject/NPXecSSL40_Install.jar';
var packageName = 'XecureWeb SSL 4.0 Plug-in'
var updateObjectName = 'XecureWeb SSL 4.0 Plug-in';
var versionMaj = 4;
var versionMin = 1;
var versionRel = 1;
var versionBld = 20001215;
function process_error ( errCode, errMsg ) {
alert( "¿¡·¯ÄÚµå : " + errCode + "\n\n" + errMsg );
}
function escape_url(url) {
var i;
var ch;
var out = '';
var url_string = '';
url_string = String(url);
for (i = 0; i < url_string.length; i++) {
ch = url_string.charAt(i);
if (ch == ' ')
out += '%20';
else if (ch == '%')
out += '%25';
else if (ch == '&')
out += '%26';
else if (ch == '+')
out += '%2B';
else if (ch == '=')
out += '%3D';
else if (ch == '?')
out += '%3F';
else
out += ch;
}
return out;
}
function XecureNavigate_NoEnc( url, target ) {
var qs ;
var path = "/";
var cipher;
var xecure_url;
var errCode;
var errMsg = "";
// get path info & query string & hash from url
qs_begin_index = url.indexOf('?');
if ( qs_begin_index < 0 ) {
qs = "";
// if action is relative url, get base url from window location
if ( url.charAt(0) != '/' && url.substring(0,7) != "http://" ) {
// path_end = window.location.pathname.lastIndexOf('/');
// path = window.location.pathname.substring(0,path_end+1) + url;
//path_end = window.location.href.indexOf('?');
path_end_str = window.location.href;//.substring(0,path_end);
path_relative_base_end = path_end_str.lastIndexOf('/');
path_relative_base_str = path_end_str.substring(0,path_relative_base_end+1);
path_begin_index = path_relative_base_str.substring (7,path_relative_base_str.length).indexOf('/');
path = path_relative_base_str.substring( 7+path_begin_index,path_relative_base_str.length ) + url;
}
else if ( url.substring(0,7) == "http://" ) {
path_begin_index = url.substring (7,url.length).indexOf('/');
path = url.substring( path_begin_index + 7 , url.length);
}
else
path = url;
}
else {
qs = url.substring(qs_begin_index + 1, url.length );
if ( url.charAt(0) != '/' && url.substring(0,7) != "http://" ) {
// path_end = window.location.pathname.lastIndexOf('/');
// path = window.location.pathname.substring(0,path_end+1) + url.substring(0,qs_begin_index);
path_end = window.location.href.indexOf('?');
path_end_str = window.location.href.substring(0,path_end);
path_relative_base_end = path_end_str.lastIndexOf('/');
path_relative_base_str = path_end_str.substring(0,path_relative_base_end+1);
path_begin_index = path_relative_base_str.substring (7,path_relative_base_str.length).indexOf('/');
path = path_relative_base_str.substring( 7+path_begin_index,path_relative_base_str.length ) + url.substring(0,qs_begin_index);
}
else if ( url.substring(0,7) == "http://" ) {
path_begin_index = url.substring (7,url.length).indexOf('/');
path = url.substring( path_begin_index + 7 , qs_begin_index );
}
else
path = url.substring(0, qs_begin_index );
}
cipher = document.XecureWeb.BlockEnc ( xgate_addr, path, "", "GET" );
if( cipher == "" ) {
if(navigator.appName != 'Netscape'){
errCode = document.XecureWeb.LastErrCode();
errMsg = document.XecureWeb.LastErrMsg();
}
else {
errCode = document.XecureWeb.LastErrCode();
errMsg = unescape(document.XecureWeb.LastErrMsg());
}
process_error( errCode, errMsg );
return false;
}
if ( qs == "" )
xecure_url = path + "?q=" + escape_url(cipher) ;
else
xecure_url = path + "?q=" + escape_url(cipher) + "&" + qs;
open ( xecure_url, target );
}
function get_sid() {
var cipher = document.XecureWeb.BlockEnc ( xgate_addr, "", "", "GET" );
if( cipher == "" ) {
if(navigator.appName != 'Netscape'){
errCode = document.XecureWeb.LastErrCode();
errMsg = document.XecureWeb.LastErrMsg();
}
else {
errCode = document.XecureWeb.LastErrCode();
errMsg = unescape(document.XecureWeb.LastErrMsg());
}
process_error( errCode, errMsg );
return false;
}
return escape_url(cipher);
}
function XecureNavigate( url, target, feature ) {
var qs ;
var path = "/";
var cipher;
var xecure_url;
var errCode;
var errMsg = "";
// get path info & query string & hash from url
qs_begin_index = url.indexOf('?');
if ( qs_begin_index < 0 ) {
qs = "";
// if action is relative url, get base url from window location
if ( url.charAt(0) != '/' && url.substring(0,7) != "http://" ) {
// path_end = window.location.pathname.lastIndexOf('/');
// path = window.location.pathname.substring(0,path_end+1) + url;
//path_end = window.location.href.indexOf('?');
path_end_str = window.location.href;//.substring(0,path_end);
path_relative_base_end = path_end_str.lastIndexOf('/');
path_relative_base_str = path_end_str.substring(0,path_relative_base_end+1);
path_begin_index = path_relative_base_str.substring (7,path_relative_base_str.length).indexOf('/');
path = path_relative_base_str.substring( 7+path_begin_index,path_relative_base_str.length ) + url;
}
else if ( url.substring(0,7) == "http://" ) {
path_begin_index = url.substring (7,url.length).indexOf('/');
path = url.substring( path_begin_index + 7 , url.length);
}
else
path = url;
}
else {
qs = url.substring(qs_begin_index + 1, url.length );
if ( url.charAt(0) != '/' && url.substring(0,7) != "http://" ) {
// path_end = window.location.pathname.lastIndexOf('/');
// path = window.location.pathname.substring(0,path_end+1) + url.substring(0,qs_begin_index );
path_end = window.location.href.indexOf('?');
path_end_str = window.location.href.substring(0,path_end);
path_relative_base_end = path_end_str.lastIndexOf('/');
path_relative_base_str = path_end_str.substring(0,path_relative_base_end+1);
path_begin_index = path_relative_base_str.substring (7,path_relative_base_str.length).indexOf('/');
path = path_relative_base_str.substring( 7+path_begin_index,path_relative_base_str.length ) + url.substring(0,qs_begin_index);
}
else if ( url.substring(0,7) == "http://" ) {
path_begin_index = url.substring (7,url.length).indexOf('/');
path = url.substring( path_begin_index + 7 , qs_begin_index );
}
else
path = url.substring(0, qs_begin_index );
}
if(navigator.appName == 'Netscape') {
cipher = document.XecureWeb.BlockEnc(xgate_addr, path, escape(qs),"GET");
}
else
cipher = document.XecureWeb.BlockEnc ( xgate_addr, path, qs, "GET" );
if( cipher == "" ) {
if(navigator.appName != 'Netscape'){
errCode = document.XecureWeb.LastErrCode();
errMsg = document.XecureWeb.LastErrMsg();
}
else {
errCode = document.XecureWeb.LastErrCode();
errMsg = unescape(document.XecureWeb.LastErrMsg());
}
process_error( errCode, errMsg );
return false;
}
xecure_url = path + "?q=" + escape_url(cipher);
//if (feature=="" || feature==null) open ( xecure_url, target );
if (feature=="" || feature==null) target.location.href = xecure_url;
else open(xecure_url, target, feature );
}
//ǻóÀÇ °íÀçÈñ ¼öÁ¤ 2002.08.07
function XecureNavigate_fg( url, target, feature, scr_id ) {
var qs ;
var path = "/";
var cipher;
var xecure_url;
var errCode;
var errMsg = "";
// get path info & query string & hash from url
qs_begin_index = url.indexOf('?');
if ( qs_begin_index < 0 ) {
qs = "";
// if action is relative url, get base url from window location
if ( url.charAt(0) != '/' && url.substring(0,7) != "http://" ) {
// path_end = window.location.pathname.lastIndexOf('/');
// path = window.location.pathname.substring(0,path_end+1) + url;
//path_end = window.location.href.indexOf('?');
path_end_str = window.location.href;//.substring(0,path_end);
path_relative_base_end = path_end_str.lastIndexOf('/');
path_relative_base_str = path_end_str.substring(0,path_relative_base_end+1);
path_begin_index = path_relative_base_str.substring (7,path_relative_base_str.length).indexOf('/');
path = path_relative_base_str.substring( 7+path_begin_index,path_relative_base_str.length ) + url;
}
else if ( url.substring(0,7) == "http://" ) {
path_begin_index = url.substring (7,url.length).indexOf('/');
path = url.substring( path_begin_index + 7 , url.length);
}
else
path = url;
}
else {
qs = url.substring(qs_begin_index + 1, url.length );
if ( url.charAt(0) != '/' && url.substring(0,7) != "http://" ) {
// path_end = window.location.pathname.lastIndexOf('/');
// path = window.location.pathname.substring(0,path_end+1) + url.substring(0,qs_begin_index );
path_end = window.location.href.indexOf('?');
path_end_str = window.location.href.substring(0,path_end);
path_relative_base_end = path_end_str.lastIndexOf('/');
path_relative_base_str = path_end_str.substring(0,path_relative_base_end+1);
path_begin_index = path_relative_base_str.substring (7,path_relative_base_str.length).indexOf('/');
path = path_relative_base_str.substring( 7+path_begin_index,path_relative_base_str.length ) + url.substring(0,qs_begin_index);
}
else if ( url.substring(0,7) == "http://" ) {
path_begin_index = url.substring (7,url.length).indexOf('/');
path = url.substring( path_begin_index + 7 , qs_begin_index );
}
else
path = url.substring(0, qs_begin_index );
}
if(navigator.appName == 'Netscape') {
cipher = document.XecureWeb.BlockEnc(xgate_addr, path, escape(qs),"GET");
}
else
cipher = document.XecureWeb.BlockEnc ( xgate_addr, path, qs, "GET" );
if( cipher == "" ) {
if(navigator.appName != 'Netscape'){
errCode = document.XecureWeb.LastErrCode();
errMsg = document.XecureWeb.LastErrMsg();
}
else {
errCode = document.XecureWeb.LastErrCode();
errMsg = unescape(document.XecureWeb.LastErrMsg());
}
process_error( errCode, errMsg );
return false;
}
xecure_url = path + "?q=" + escape_url(cipher) + "&scr_id=" + scr_id;
if (feature=="" || feature==null) open ( xecure_url, target );
else if (feature=="opener") target.location.href = xecure_url;
else open(xecure_url, target, feature );
}
function XecureNavigate1( url, target, feature, sid) {
var qs ;
var path = "/";
var cipher;
var xecure_url;
var errCode;
var errMsg = "";
// get path info & query string & hash from url
qs_begin_index = url.indexOf('?');
if ( qs_begin_index < 0 ) {
qs = "";
// if action is relative url, get base url from window location
if ( url.charAt(0) != '/' && url.substring(0,7) != "http://" ) {
// path_end = window.location.pathname.lastIndexOf('/');
// path = window.location.pathname.substring(0,path_end+1) + url;
//path_end = window.location.href.indexOf('?');
path_end_str = window.location.href;//.substring(0,path_end);
path_relative_base_end = path_end_str.lastIndexOf('/');
path_relative_base_str = path_end_str.substring(0,path_relative_base_end+1);
path_begin_index = path_relative_base_str.substring (7,path_relative_base_str.length).indexOf('/');
path = path_relative_base_str.substring( 7+path_begin_index,path_relative_base_str.length ) + url;
}
else if ( url.substring(0,7) == "http://" ) {
path_begin_index = url.substring (7,url.length).indexOf('/');
path = url.substring( path_begin_index + 7 , url.length);
}
else
path = url;
}
else {
qs = url.substring(qs_begin_index + 1, url.length );
if ( url.charAt(0) != '/' && url.substring(0,7) != "http://" ) {
// path_end = window.location.pathname.lastIndexOf('/');
// path = window.location.pathname.substring(0,path_end+1) + url.substring(0,qs_begin_index );
path_end = window.location.href.indexOf('?');
path_end_str = window.location.href.substring(0,path_end);
path_relative_base_end = path_end_str.lastIndexOf('/');
path_relative_base_str = path_end_str.substring(0,path_relative_base_end+1);
path_begin_index = path_relative_base_str.substring (7,path_relative_base_str.length).indexOf('/');
path = path_relative_base_str.substring( 7+path_begin_index,path_relative_base_str.length ) + url.substring(0,qs_begin_index);
}
else if ( url.substring(0,7) == "http://" ) {
path_begin_index = url.substring (7,url.length).indexOf('/');
path = url.substring( path_begin_index + 7 , qs_begin_index );
}
else
path = url.substring(0, qs_begin_index );
}
if(navigator.appName == 'Netscape') {
cipher = document.XecureWeb.BlockEnc(xgate_addr, path, escape(qs),"POST");
}
else
cipher = document.XecureWeb.BlockEnc ( xgate_addr, path, qs, "POST" );
if( cipher == "" ) {
if(navigator.appName != 'Netscape'){
errCode = document.XecureWeb.LastErrCode();
errMsg = document.XecureWeb.LastErrMsg();
}
else {
errCode = document.XecureWeb.LastErrCode();
errMsg = unescape(document.XecureWeb.LastErrMsg());
}
process_error( errCode, errMsg );
return false;
}
xecure_url = path + "?q=" + sid + ";" + escape_url(cipher);
if (feature=="" || feature==null) open ( xecure_url, target );
else open(xecure_url, target, feature );
}
function XecureLink( link ) {
var qs ;
var path = "/";
var cipher;
var errCode;
var errMsg = "";
// get path info & query string from action url
if ( link.protocol != "http:" ) {
// alert ( "http ÇÁ·ÎÅäÄݸ¸ »ç¿ë °¡´ÉÇÕ´Ï´Ù." );
return true;
}
qs = link.search;
if ( qs.length > 1 ) {
qs = link.search.substring(1);
}
hash = link.hash;
if(navigator.appName == 'Netscape') {
path = link.pathname;
cipher = document.XecureWeb.BlockEnc(xgate_addr, path, escape(qs),"GET");
}
else {
path = "/" + link.pathname;
cipher = document.XecureWeb.BlockEnc ( xgate_addr, path, qs, "GET" );
}
if( cipher == "" ) {
if(navigator.appName != 'Netscape'){
errCode = document.XecureWeb.LastErrCode();
errMsg = document.XecureWeb.LastErrMsg();
}
else {
errCode = document.XecureWeb.LastErrCode();
errMsg = unescape(document.XecureWeb.LastErrMsg());
}
process_error( errCode, errMsg );
return false;
}
// link.search = "?q=" + escape_url(cipher);
xecure_url = "http://" + link.host + path + hash + "?q=" + escape_url(cipher);
if ( link.target == "" || link.target == null ) open ( xecure_url, "_self" );
else open( xecure_url, link.target );
return false;
}
function XecureLink_page( link, page_id ) {
var qs ;
var path = "/";
var cipher;
var errCode;
var errMsg = "";
// get path info & query string from action url
if ( link.protocol != "http:" ) {
// alert ( "http ÇÁ·ÎÅäÄݸ¸ »ç¿ë °¡´ÉÇÕ´Ï´Ù." );
return true;
}
qs = link.search;
if ( qs.length > 1 ) {
qs = link.search.substring(1);
}
hash = link.hash;
if(navigator.appName == 'Netscape') {
path = link.pathname;
cipher = document.XecureWeb.BlockEnc(xgate_addr, path, escape(qs),"GET");
}
else {
path = "/" + link.pathname;
cipher = document.XecureWeb.BlockEnc ( xgate_addr, path, qs, "GET" );
}
if( cipher == "" ) {
if(navigator.appName != 'Netscape'){
errCode = document.XecureWeb.LastErrCode();
errMsg = document.XecureWeb.LastErrMsg();
}
else {
errCode = document.XecureWeb.LastErrCode();
errMsg = unescape(document.XecureWeb.LastErrMsg());
}
process_error( errCode, errMsg );
return false;
}
// link.search = "?q=" + escape_url(cipher);
xecure_url = "http://" + link.host + path + hash + "?q=" + escape_url(cipher);
if ( link.target == "" || link.target == null ) open ( xecure_url, "_self" );
else open( xecure_url, link.target );
return false;
}
//¼öÁ¤ 2002.08.13 ǻó °íÀçÈñ ¼öÁ¤
function XecureLink_page_fg( link, scr_id ) {
var qs ;
var path = "/";
var cipher;
var errCode;
var errMsg = "";
// get path info & query string from action url
if ( link.protocol != "http:" ) {
// alert ( "http ÇÁ·ÎÅäÄݸ¸ »ç¿ë °¡´ÉÇÕ´Ï´Ù." );
return true;
}
qs = link.search;
if ( qs.length > 1 ) {
qs = link.search.substring(1);
}
hash = link.hash;
if(navigator.appName == 'Netscape') {
path = link.pathname;
cipher = document.XecureWeb.BlockEnc(xgate_addr, path, escape(qs),"GET");
}
else {
path = "/" + link.pathname;
cipher = document.XecureWeb.BlockEnc ( xgate_addr, path, qs, "GET" );
}
if( cipher == "" ) {
if(navigator.appName != 'Netscape'){
errCode = document.XecureWeb.LastErrCode();
errMsg = document.XecureWeb.LastErrMsg();
}
else {
errCode = document.XecureWeb.LastErrCode();
errMsg = unescape(document.XecureWeb.LastErrMsg());
}
process_error( errCode, errMsg );
return false;
}
// link.search = "?q=" + escape_url(cipher);
xecure_url = "http://" + link.host + path + hash + "?q=" + escape_url(cipher) + "&scr_id=" + scr_id;
if ( link.target == "" || link.target == null ) open ( xecure_url, "_self" );
else open( xecure_url, link.target );
return false;
}
function XecureSubmit( form ) {
var qs ;
var path ;
var cipher;
var errCode;
var errMsg = "";
// get path info & query string & hash from action url
qs_begin_index = form.action.indexOf('?');
if ( qs_begin_index < 0 ) {
qs = "";
// if action is relative url, get base url from window location
if ( form.action.charAt(0) != '/' && form.action.substring(0,7) != "http://" ) {
// path_end = window.location.pathname.lastIndexOf('/');
// path = window.location.pathname.substring(0,path_end+1) + form.action;
//path_end = window.location.href.indexOf('?');
path_end_str = window.location.href;//.substring(0,path_end);
path_relative_base_end = path_end_str.lastIndexOf('/');
path_relative_base_str = path_end_str.substring(0,path_relative_base_end+1);
path_begin_index = path_relative_base_str.substring (7,path_relative_base_str.length).indexOf('/');
path = path_relative_base_str.substring( 7+path_begin_index,path_relative_base_str.length ) + form.action;
}
else if ( form.action.substring(0,7) == "http://" ) {
path_begin_index = form.action.substring (7,form.action.length).indexOf('/');
path = form.action.substring( path_begin_index + 7 , form.action.length);
}
else{
path = form.action;
}
}
else {
qs = form.action.substring(qs_begin_index + 1, form.action.length );
if ( form.action.charAt(0) != '/' && form.action.substring(0,7) != "http://" ) {
// path_end = window.location.pathname.lastIndexOf('/');
// path = window.location.pathname.substring(0,path_end+1) + form.action.substring(0,qs_begin_index );
path_end = window.location.href.indexOf('?');
path_end_str = window.location.href.substring(0,path_end);
path_relative_base_end = path_end_str.lastIndexOf('/');
path_relative_base_str = path_end_str.substring(0,path_relative_base_end+1);
path_begin_index = path_relative_base_str.substring (7,path_relative_base_str.length).indexOf('/');
path = path_relative_base_str.substring( 7+path_begin_index,path_relative_base_str.length ) + form.action.substring(0,qs_begin_index);
}
else if ( form.action.substring(0,7) == "http://" ) {
path_begin_index = form.action.substring (7,form.action.length).indexOf('/');
path = form.action.substring( path_begin_index + 7 , qs_begin_index);
}
else {
path = form.action.substring(0, qs_begin_index );
}
}
document.xecure.target = form.target;
if ( form.method == "get" || form.method=="GET" ) {
// collect input field values
qs = XecureMakePlain( form );
// encrypt QueryString
if(navigator.appName == 'Netscape') {
cipher = document.XecureWeb.BlockEnc(xgate_addr, path, escape(qs),"GET");
}
else
cipher = document.XecureWeb.BlockEnc ( xgate_addr, path, qs, "GET" );
if( cipher == "" ) {
if(navigator.appName != 'Netscape'){
errCode = document.XecureWeb.LastErrCode();
errMsg = document.XecureWeb.LastErrMsg();
}
else {
errCode = document.XecureWeb.LastErrCode();
errMsg = unescape(document.XecureWeb.LastErrMsg());
}
process_error( errCode, errMsg );
return false;
}
xecure_url = path + "?q=" + escape_url(cipher);
// alert("cipher(get) = " + cipher);
if ( form.target == "" || form.target == null ) open( xecure_url, "_self");
else open ( xecure_url, form.target );
}
else {
document.xecure.method = "post";
// encrypt QueryString of action field
if(navigator.appName == 'Netscape') {
cipher = document.XecureWeb.BlockEnc(xgate_addr, path, escape(qs),"GET");
}
else
cipher = document.XecureWeb.BlockEnc ( xgate_addr, path, qs, "GET" );
if( cipher == "" ) {
if(navigator.appName != 'Netscape'){
errCode = document.XecureWeb.LastErrCode();
errMsg = document.XecureWeb.LastErrMsg();
}
else {
errCode = document.XecureWeb.LastErrCode();
errMsg = unescape(document.XecureWeb.LastErrMsg());
}
process_error( errCode, errMsg );
return false;
}
document.xecure.action = path + "?q=" + escape_url(cipher);
posting_data = XecureMakePlain( form );
if(navigator.appName == 'Netscape'){
cipher = document.XecureWeb.BlockEnc ( xgate_addr, path, escape(posting_data), "POST" );
}
else
cipher = document.XecureWeb.BlockEnc ( xgate_addr, path, posting_data, "POST" );
if( cipher == "" ) {
if(navigator.appName != 'Netscape'){
errCode = document.XecureWeb.LastErrCode();
errMsg = document.XecureWeb.LastErrMsg();
}
else {
errCode = document.XecureWeb.LastErrCode();
errMsg = unescape(document.XecureWeb.LastErrMsg());
}
process_error( errCode, errMsg );
return false;
}
document.xecure.p.value = cipher;
// alert("cipher(post) = " + cipher);
// Ãß°¡ ³¡
document.xecure.submit();
}
return false;
}
//ǻóÀÇ °íÀçÈñ ¼öÁ¤ 2002.08.07
function XecureSubmit_fg(form) {
var qs ;
var path ;
var cipher;
var errCode;
var errMsg = "";
// get path info & query string & hash from action url
qs_begin_index = form.action.indexOf('?');
if ( qs_begin_index < 0 ) {
qs = "";
// if action is relative url, get base url from window location
if ( form.action.charAt(0) != '/' && form.action.substring(0,7) != "http://" ) {
// path_end = window.location.pathname.lastIndexOf('/');
// path = window.location.pathname.substring(0,path_end+1) + form.action;
//path_end = window.location.href.indexOf('?');
path_end_str = window.location.href;//.substring(0,path_end);
path_relative_base_end = path_end_str.lastIndexOf('/');
path_relative_base_str = path_end_str.substring(0,path_relative_base_end+1);
path_begin_index = path_relative_base_str.substring (7,path_relative_base_str.length).indexOf('/');
path = path_relative_base_str.substring( 7+path_begin_index,path_relative_base_str.length ) + form.action;
}
else if ( form.action.substring(0,7) == "http://" ) {
path_begin_index = form.action.substring (7,form.action.length).indexOf('/');
path = form.action.substring( path_begin_index + 7 , form.action.length);
}
else{
path = form.action;
}
}
else {
qs = form.action.substring(qs_begin_index + 1, form.action.length );
if ( form.action.charAt(0) != '/' && form.action.substring(0,7) != "http://" ) {
// path_end = window.location.pathname.lastIndexOf('/');
// path = window.location.pathname.substring(0,path_end+1) + form.action.substring(0,qs_begin_index );
path_end = window.location.href.indexOf('?');
path_end_str = window.location.href.substring(0,path_end);
path_relative_base_end = path_end_str.lastIndexOf('/');
path_relative_base_str = path_end_str.substring(0,path_relative_base_end+1);
path_begin_index = path_relative_base_str.substring (7,path_relative_base_str.length).indexOf('/');
path = path_relative_base_str.substring( 7+path_begin_index,path_relative_base_str.length ) + form.action.substring(0,qs_begin_index);
}
else if ( form.action.substring(0,7) == "http://" ) {
path_begin_index = form.action.substring (7,form.action.length).indexOf('/');
path = form.action.substring( path_begin_index + 7 , qs_begin_index);
}
else {
path = form.action.substring(0, qs_begin_index );
}
}
document.xecure.target = form.target;
if ( form.method == "get" || form.method=="GET" ) {
// collect input field values
qs = XecureMakePlain( form );
// encrypt QueryString
if(navigator.appName == 'Netscape') {
cipher = document.XecureWeb.BlockEnc(xgate_addr, path, escape(qs),"GET");
}
else
cipher = document.XecureWeb.BlockEnc ( xgate_addr, path, qs, "GET" );
if( cipher == "" ) {
if(navigator.appName != 'Netscape'){
errCode = document.XecureWeb.LastErrCode();
errMsg = document.XecureWeb.LastErrMsg();
}
else {
errCode = document.XecureWeb.LastErrCode();
errMsg = unescape(document.XecureWeb.LastErrMsg());
}
process_error( errCode, errMsg );
return false;
}
xecure_url = path + "?q=" + escape_url(cipher);
// alert("cipher(get) = " + cipher);
if ( form.target == "" || form.target == null ) open( xecure_url, "_self");
else open ( xecure_url, form.target );
}
else {
document.xecure.method = "post";
// encrypt QueryString of action field
if(navigator.appName == 'Netscape') {
cipher = document.XecureWeb.BlockEnc(xgate_addr, path, escape(qs),"GET");
}
else
cipher = document.XecureWeb.BlockEnc ( xgate_addr, path, qs, "GET" );
if( cipher == "" ) {
if(navigator.appName != 'Netscape'){
errCode = document.XecureWeb.LastErrCode();
errMsg = document.XecureWeb.LastErrMsg();
}
else {
errCode = document.XecureWeb.LastErrCode();
errMsg = unescape(document.XecureWeb.LastErrMsg());
}
process_error( errCode, errMsg );
return false;
}
document.xecure.action = path + "?q=" + escape_url(cipher);
posting_data = XecureMakePlain( form );
if(navigator.appName == 'Netscape'){
cipher = document.XecureWeb.BlockEnc ( xgate_addr, path, escape(posting_data), "POST" );
}
else
cipher = document.XecureWeb.BlockEnc ( xgate_addr, path, posting_data, "POST" );
if( cipher == "" ) {
if(navigator.appName != 'Netscape'){
errCode = document.XecureWeb.LastErrCode();
errMsg = document.XecureWeb.LastErrMsg();
}
else {
errCode = document.XecureWeb.LastErrCode();
errMsg = unescape(document.XecureWeb.LastErrMsg());
}
process_error( errCode, errMsg );
return false;
}
document.xecure.p.value = cipher;
// alert("cipher(post) = " + cipher);
// Ãß°¡ ³¡
//alert(cipher);
document.xecure.submit();
}
return false;
}
function XecureMakePlain(form) {
var name = new Array(form.elements.length);
var value = new Array(form.elements.length);
var flag = false;
var j = 0;
var plain_text="";
len = form.elements.length;
for (i = 0; i < len; i++) {
if ((form.elements[i].type != "button") && (form.elements[i].type != "reset") && (form.elements[i].type != "submit")) {
if (form.elements[i].type == "radio" || form.elements[i].type == "checkbox") { // Leejh 99.11.10 checkboxÃß°¡
if (form.elements[i].checked == true) {
name[j] = form.elements[i].name;
value[j] = form.elements[i].value;
j++;
}
}
else {
name[j] = form.elements[i].name;
if (form.elements[i].type == "select-one") {
var ind = form.elements[i].selectedIndex;
if (form.elements[i].options[ind].value != '')
value[j] = form.elements[i].options[ind].value;
else
value[j] = form.elements[i].options[ind].text;
// form.elements[i].selectedIndex = 0;
}
else {
value[j] = form.elements[i].value;
}
j++;
}
}
}
for (i = 0; i < j; i++) {
str = value[i];
value[i] = escape_url(str);
}
for (i = 0; i < j; i++) {
if (flag)
plain_text += "&";
else
flag = true;
plain_text += name[i] ;
plain_text += "=";
plain_text += value[i];
}
return plain_text;
}
function BlockDec(cipher)
{
var plain = "";
var errCode = 0;
var errMsg = "";
if(navigator.appName == 'Netscape'){
plain = unescape(document.XecureWeb.BlockDec( xgate_addr, cipher));
}
else
plain = document.XecureWeb.BlockDec ( xgate_addr, cipher );
if( plain == "" ) {
if(navigator.appName != 'Netscape'){
errCode = document.XecureWeb.LastErrCode();
errMsg = document.XecureWeb.LastErrMsg();
}
else {
errCode = document.XecureWeb.LastErrCode();
errMsg = unescape(document.XecureWeb.LastErrMsg());
}
process_error( errCode, errMsg );
}
return plain;
}
function BlockXMLDec(cipher)
{
var path = "";
var errCode = 0;
var errMsg = "";
if(navigator.appName == 'Netscape'){
path = unescape(document.XecureWeb.BlockXMLDec( xgate_addr, cipher));
}
else
path = document.XecureWeb.BlockXMLDec ( xgate_addr, cipher );
if( path == "" ) {
if(navigator.appName != 'Netscape'){
errCode = document.XecureWeb.LastErrCode();
errMsg = document.XecureWeb.LastErrMsg();
}
else {
errCode = document.XecureWeb.LastErrCode();
errMsg = unescape(document.XecureWeb.LastErrMsg());
}
process_error( errCode, errMsg );
}
return path;
}
function XecureLogIn( link )
{
EndSession();
return XecureLink(link);
}
function EndSession()
{
document.XecureWeb.EndSession( xgate_addr );
}
function Sign( plain )
{
var signed_msg;
if(navigator.appName != 'Netscape')
signed_msg = document.XecureWeb.SignData ( xgate_addr,accept_cert, plain, show_plain, sign_desc );
else
signed_msg = document.XecureWeb.SignData ( xgate_addr,escape(accept_cert), escape(plain), show_plain, escape(sign_desc) );
if( signed_msg == "" ) {
if(navigator.appName != 'Netscape'){
errCode = document.XecureWeb.LastErrCode();
errMsg = document.XecureWeb.LastErrMsg();
}
else {
errCode = document.XecureWeb.LastErrCode();
errMsg = unescape(document.XecureWeb.LastErrMsg());
}
process_error( errCode, errMsg );
}
return signed_msg;
}
function Sign_with_desc( plain, desc )
{
var signed_msg;
if(navigator.appName != 'Netscape')
signed_msg = document.XecureWeb.SignData ( xgate_addr,accept_cert, plain, show_plain, desc );
else
signed_msg = document.XecureWeb.SignData ( xgate_addr,escape(accept_cert), escape(plain), show_plain, escape(desc) );
if( signed_msg == "" ) {
if(navigator.appName != 'Netscape'){
errCode = document.XecureWeb.LastErrCode();
errMsg = document.XecureWeb.LastErrMsg();
}
else {
errCode = document.XecureWeb.LastErrCode();
errMsg = unescape(document.XecureWeb.LastErrMsg());
}
process_error( errCode, errMsg );
}
return signed_msg;
}
function RequestCertificate ( ref_code, auth_code )
{
var r = document.XecureWeb.RequestCertificate ( ca_port, ca_ip, ref_code, auth_code );
if ( r != 0 ) {
if(navigator.appName != 'Netscape'){
errCode = document.XecureWeb.LastErrCode();
errMsg = document.XecureWeb.LastErrMsg();
}
else {
errCode = document.XecureWeb.LastErrCode();
errMsg = unescape(document.XecureWeb.LastErrMsg());
}
process_error( errCode, errMsg );
}
return r;
}
function RenewCertificate ( )
{
var r = document.XecureWeb.RenewCertificate ( ca_port, ca_ip );
if ( r != 0 ) {
if(navigator.appName != 'Netscape'){
errCode = document.XecureWeb.LastErrCode();
errMsg = document.XecureWeb.LastErrMsg();
}
else {
errCode = document.XecureWeb.LastErrCode();
errMsg = unescape(document.XecureWeb.LastErrMsg());
}
process_error( errCode, errMsg );
}
return r;
}
function RevokeCertificate ( jobcode, reason )
{
var r;
r = document.XecureWeb.RevokeCertificate ( ca_port, ca_ip, jobcode, reason );
if ( r != 0 ) {
if(navigator.appName != 'Netscape'){
errCode = document.XecureWeb.LastErrCode();
errMsg = document.XecureWeb.LastErrMsg();
}
else {
errCode = document.XecureWeb.LastErrCode();
errMsg = unescape(document.XecureWeb.LastErrMsg());
}
process_error( errCode, errMsg );
}
return r;
}
function GenCertReq ( )
{
cert_req = document.XecureWeb.GenerateCertReq( 1024 );
if ( cert_req == "" ) {
if(navigator.appName != 'Netscape'){
errCode = document.XecureWeb.LastErrCode();
errMsg = document.XecureWeb.LastErrMsg();
}
else {
errCode = document.XecureWeb.LastErrCode();
errMsg = unescape(document.XecureWeb.LastErrMsg());
}
process_error( errCode, errMsg );
}
return cert_req;
}
function InstallCertificate (cert_type, cert)
{
document.XecureWeb.InstallCertificate(cert_type, cert );
}
function ShowCertManager()
{
document.XecureWeb.ShowCertManager();
}
function PutBannerUrl()
{
document.XecureWeb.PutBannerUrl( xgate_addr, bannerUrl);
}
function PutCACert()
{
var errCode;
var errMsg = "";
var r;
if(navigator.appName != 'Netscape')
r = document.XecureWeb.PutCACert( pCaCertName, pCaCertUrl);
else
r = document.XecureWeb.PutCACert( escape(pCaCertName), pCaCertUrl);
r = document.XecureWeb.PutCACert( pCaCertName, pCaCertUrl);
if( r != 0 ) {
if(navigator.appName != 'Netscape'){
errCode = document.XecureWeb.LastErrCode();
errMsg = document.XecureWeb.LastErrMsg();
}
else {
errCode = document.XecureWeb.LastErrCode();
errMsg = unescape(document.XecureWeb.LastErrMsg());
}
alert(errMsg);
}
}
function isNewPlugin(desc)
{
index = desc.indexOf('v.', 0);
if (index < 0)
return false;
desc += ' ';
versionString = desc.substring(index +2, desc.length);
arrayOfStrings = versionString.split('.');
thisMajor = parseInt(arrayOfStrings[0], 10);
thisMinor = parseInt(arrayOfStrings[1], 10);
thisBuild = parseInt(arrayOfStrings[2], 10);
if (thisMajor > versionMaj)
return true;
else if (thisMajor < versionMaj)
return false;
if (thisMinor > versionMin)
return true;
else if (thisMinor < versionMin)
return false;
if (thisBuild > versionRel)
return true;
else if (thisBuild < versionRel)
return false;
return true;
}
function downloadNow () {
if ( navigator.javaEnabled() ) {
trigger = netscape.softupdate.Trigger;
if ( trigger.UpdateEnabled() ) {
if (navigator.platform == "Win32") {
trigger.StartSoftwareUpdate( packageURL, trigger.DEFAULT_MODE);
}
else alert('ÀÌ Ç÷¯±× ÀÎÀº À©µµ¿ìÁî 95/98/NT ȯ°æ¿¡¼¸¸ ÀÛµ¿ÇÕ´Ï´Ù.')
}
else
alert('³Ý½ºÄÉÀÔÀÇ SmartUpdate ¼³Ä¡¸¦ °¡´ÉÇϵµ·Ï ÇØ¾ßÇÕ´Ï´Ù.');
}
else
alert('Java ½ÇÇàÀ» °¡´ÉÇϵµ·Ï ÇØ¾ßÇÕ´Ï´Ù.');
}
function PrintObjectTag()
{
if(navigator.appName == 'Netscape')
{
document.write("No XecureWeb PlugIn");
}
else if( (navigator.appName == "Microsoft Internet Explorer") && (navigator.userAgent.toLowerCase().indexOf("trident/4.0") != -1) )
{
document.write('');
}
else
{
document.write('');
}
}