<html>
  <head>
    <meta HTTP-EQUIV='Pragma' CONTENT='no-cache'>
    <link rel="stylesheet" href='stylemain.css' type='text/css'>
      <link rel="stylesheet" href='colors.css' type='text/css'>
        <script language="javascript" src="util.js"></script>
        <script type="text/javascript" src="lang/b28n.js"></script>
        <script language="javascript"><%ejGetOther(forbidHTMLCode)%></script>           
        <script language="javascript">
<!-- hide

var keystart = '-----BEGIN RSA PRIVATE KEY-----';
var keyinsert = '\n<insert private key here>\n';
var keyend = '-----END RSA PRIVATE KEY-----';
var certstart = '-----BEGIN CERTIFICATE-----';
var certinsert = '\n<insert certificate here>\n';
var certend = '-----END CERTIFICATE-----';
var sessionKey='<%ejGetOther(sessionKey)%>';

setLanguage('<%ejGet(webUILanguage)%>'); 

function initTranslation() {
	var idArray = new Array("certImportTile", "certImportTips", "certImportCertName", "certImportCertificate", "certImportPriKey", "certImportBtnApply");
	setAllIdValue(idArray);
}
function frmLoad() {
  initTranslation();
  document.importForm.action = 'certlocal.cmd?action=import&sessionKey=' + sessionKey;
  with ( document.forms[0] ) {
    certPrivate.value = keystart + keyinsert + keyend + '\n';
    certPublic.value = certstart + certinsert + certend + '\n';
  }
}

function applyClick() {
  var idx;
 
  with ( document.forms[0] ) {
    if ( certName.value == '' ) {
      alert(_("certImportAlert1"));
      return;
    }
    if ( certPrivate.value == '' ) {
      alert(_("certImportAlert2"));
      return;
    }
    if ( certPublic.value == '' ) {
      alert(_("certImportAlert3"));
      return;
    }
  }
  document.importForm.submit();
}
// done hiding -->
</script>
  </head>
  <body onLoad='frmLoad()'>
    <blockquote>
      <form name="importForm" method="post">
        <b id="certImportTile">Import certificate<br>
        </b>
        <br>
        <span id="certImportTips">Enter certificate name, paste certificate content and private key.</span><br>
        <br>
        <table border="0" cellpadding="0" cellspacing="0">
          <tr>
            <td width="180" id="certImportCertName">Certificate Name:</td>
            <td><input type='text' name='certName' size='20' maxlength="63"></td>
          </tr>
            <tr>
              <td width="180" id="certImportCertificate">Certificate:</td>
              <td>
                <P>
                  <TEXTAREA name='certPublic' rows='20' cols='80'>
              </TEXTAREA>
                </P>
              </td>
            </tr>
            <tr>
              <td width="180" id="certImportPriKey">Private Key:</td>
              <td>
                <P>
                  <TEXTAREA name='certPrivate' rows='20' cols='80'>
              </TEXTAREA>
                </P>
              </td>
            </tr>
          </table>
        </div>
        <br>
        <br>
        <br>
        <center>
          <input type='button' value='Apply' onclick="applyClick()" id="certImportBtnApply">
        </center>
      </form>
    </blockquote>
  </body>
</html>
