From 66745131b3f9cf2346832668234661eee6ce8760 Mon Sep 17 00:00:00 2001 From: trongdd26 Date: Thu, 26 Feb 2015 09:53:56 +0700 Subject: [PATCH] Modify zimbra 8 integration --- .../src/com/ecoit/asia/EcoitApplet.java | 266 ++++++++++-- .../vn/ptit/project/encrypt/FormEncrypt.java | 8 +- .../vn/ptit/project/utils/DateFromServer.java | 71 +++ .../ajax/encryptEmail.jsp | 14 + Integration With Zimbra 8/ajax/encryptKey.jsp | 31 ++ .../ajax/encryptMail.jsp | 9 +- .../ajax/generateKey.jsp | 12 + Zimlet/com_zimbra_example_toolbarhook.js | 405 +++++++++++------- 8 files changed, 632 insertions(+), 184 deletions(-) create mode 100644 CAAppletSimple/src/vn/ptit/project/utils/DateFromServer.java create mode 100644 Integration With Zimbra 8/ajax/encryptEmail.jsp create mode 100644 Integration With Zimbra 8/ajax/encryptKey.jsp create mode 100644 Integration With Zimbra 8/ajax/generateKey.jsp diff --git a/CAAppletSimple/src/com/ecoit/asia/EcoitApplet.java b/CAAppletSimple/src/com/ecoit/asia/EcoitApplet.java index 0b06024..002942d 100644 --- a/CAAppletSimple/src/com/ecoit/asia/EcoitApplet.java +++ b/CAAppletSimple/src/com/ecoit/asia/EcoitApplet.java @@ -21,11 +21,25 @@ import java.applet.Applet; import java.io.ByteArrayInputStream; +import java.io.File; +import java.io.IOException; import java.io.InputStream; -import java.security.PrivateKey; +import java.net.MalformedURLException; +import java.net.URL; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.security.AccessController; +import java.security.PrivilegedAction; import java.security.cert.CertificateFactory; import java.security.cert.X509Certificate; +import javax.swing.JFileChooser; +import javax.swing.JOptionPane; +import javax.swing.UIManager; + +import org.apache.commons.io.FileUtils; + import sun.misc.BASE64Decoder; import sun.misc.BASE64Encoder; import vn.ptit.project.encrypt.FormEncrypt; @@ -34,42 +48,103 @@ import vn.ptit.project.token.TokenModule; import vn.ptit.project.token.TokenModules; +import com.ecoit.asia.pdfsigner.SigningModules; + public class EcoitApplet extends Applet { + public EcoitApplet() { + try { + UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); + } catch (Exception e) { + e.printStackTrace(); + } + } + private static final long serialVersionUID = 1L; + /** * * @param original * @return base64 format of signature */ - public String signForm(String original) throws SignatureException{ - return FormSigner.signForm(original); + public String signForm(final String original) { + return AccessController.doPrivileged(new PrivilegedAction() { + + @Override + public String run() { + try { + return FormSigner.signForm(original); + } catch (SignatureException e) { + e.printStackTrace(); + return null; + } + } + }); + } + /** * * @param original - * @param signature : base64 format + * @param signature + * : base64 format * @param base64Cetificate * @return * @throws Exception */ - public boolean verifyForm(String original,String signature,String base64Cetificate) throws Exception{ - byte b[] = new BASE64Decoder().decodeBuffer(base64Cetificate); - InputStream _in = new ByteArrayInputStream(b); - CertificateFactory certFactory = CertificateFactory.getInstance("X.509"); - X509Certificate cert = (X509Certificate)certFactory.generateCertificate(_in); - return FormSigner.verifyForm(signature, original, cert.getPublicKey()); + public boolean verifyForm(final String original,final String signature, + final String base64Cetificate){ + return AccessController.doPrivileged(new PrivilegedAction() { + + /* + * (non-Javadoc) + * + * @see java.security.PrivilegedAction#run() + */ + @Override + public Boolean run() { + try{ + byte b[] = new BASE64Decoder().decodeBuffer(base64Cetificate); + InputStream _in = new ByteArrayInputStream(b); + CertificateFactory certFactory = CertificateFactory + .getInstance("X.509"); + X509Certificate cert = (X509Certificate) certFactory + .generateCertificate(_in); + return FormSigner.verifyForm(signature, original, cert.getPublicKey()); + }catch(Exception ex){ + ex.printStackTrace(); + } + return false; + } + }); } + /** * * @return certificate in usb-token - */ - public String getCertificate() throws Exception{ - TokenModule token = TokenModules.newDefaultTokenModule(); - X509Certificate cer = (X509Certificate) token.getEncryptCertificate(); - return new BASE64Encoder().encode(cer.getEncoded()); + */ + public String getCertificate() { + return AccessController.doPrivileged(new PrivilegedAction() { + + /* + * (non-Javadoc) + * + * @see java.security.PrivilegedAction#run() + */ + @Override + public String run() { + try { + TokenModule token = TokenModules.newDefaultTokenModule(); + X509Certificate cer = (X509Certificate) token.getEncryptCertificate(); + return new BASE64Encoder().encode(cer.getEncoded()); + } catch (Exception e) { + e.printStackTrace(); + } + return null; + } + }); } - + /** * * @param original @@ -77,32 +152,159 @@ public String getCertificate() throws Exception{ * @return dataEncrypt * @throws Exception */ - public String encryptData(String original,String base64Certificate) throws Exception{ - TokenModule token = TokenModules.newDefaultTokenModule(); - X509Certificate cer = (X509Certificate) token.getEncryptCertificate(); - return FormEncrypt.encrypt(original, cer.getPublicKey()); + public String encryptData(final String original,final String base64Certificate){ + return AccessController.doPrivileged(new PrivilegedAction() { + + /* + * (non-Javadoc) + * + * @see java.security.PrivilegedAction#run() + */ + @Override + public String run() { + try { + TokenModule token = TokenModules.newDefaultTokenModule(); + X509Certificate cer = (X509Certificate) token.getEncryptCertificate(); + return FormEncrypt.encrypt(original, cer.getPublicKey()); + } catch (Exception e) { + e.printStackTrace(); + } + return null; + } + }); } - + /** * * @param encryptData * @return data original * @throws Exception */ - public String decryptData(String encryptData) throws Exception{ - TokenModule token = TokenModules.newDefaultTokenModule(); - return FormEncrypt.decrypt(encryptData, token.getEncryptPrivateKey()); + public String decryptData(final String encryptData) { + return AccessController.doPrivileged(new PrivilegedAction() { + + /* + * (non-Javadoc) + * + * @see java.security.PrivilegedAction#run() + */ + @Override + public String run() { + try { + TokenModule token = TokenModules.newDefaultTokenModule(); + return FormEncrypt.decrypt(encryptData, token.getEncryptPrivateKey()); + } catch (Exception e) { + e.printStackTrace(); + } + return null; + } + }); } - + /** - * Generate challenge with 100 character - * @param challenge string in base64 format - * @return response String + * Generate challenge with 100 character + * + * @param challenge + * string in base64 format + * @return response String * @throws Exception */ - public String response(String challenge) throws Exception{ - TokenModule token = TokenModules.newDefaultTokenModule(); - return FormEncrypt.authenticate(challenge, token.getEncryptPrivateKey()); + public String response(final String challenge){ + return AccessController.doPrivileged(new PrivilegedAction() { + + /* + * (non-Javadoc) + * + * @see java.security.PrivilegedAction#run() + */ + @Override + public String run() { + try { + TokenModule token = TokenModules.newDefaultTokenModule(); + return FormEncrypt + .authenticate(challenge, token.getEncryptPrivateKey()); + } catch (Exception e) { + e.printStackTrace(); + } + return null; + } + }); } -} + public String signPDF(final String url,final float minX,final float minY,final float maxX,final float maxY) { + return AccessController.doPrivileged(new PrivilegedAction() { + + /* + * (non-Javadoc) + * + * @see java.security.PrivilegedAction#run() + */ + @Override + public String run() { + System.out + .println("================ signPDF =================="); + try { + String property = "java.io.tmpdir"; + String tempDir = System.getProperty(property); + // Select signature + JFileChooser signatureFileChooser = new JFileChooser(); + signatureFileChooser.setDialogTitle("Chọn hình ảnh cho chữ ký"); + signatureFileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY); + int signatureFileChooserReturnVal = signatureFileChooser.showOpenDialog(null); + if (signatureFileChooserReturnVal == JFileChooser.APPROVE_OPTION) { + File signatureFile = signatureFileChooser.getSelectedFile(); + File f = new File(tempDir + File.separator + + "originalfile.pdf"); + FileUtils.copyURLToFile(new URL(url), f); + + String pathSigned = SigningModules.signPDF(f.getPath(),signatureFile,minX,minY,maxX,maxY); + if (pathSigned == null) + throw new Exception(); + Path path = Paths.get(pathSigned, new String[0]); + byte[] data = Files.readAllBytes(path); + return new BASE64Encoder().encode(data); +// JFileChooser chooser = new JFileChooser(); +// chooser.setDialogTitle("Chọn thư mục lưu tệp tin"); +// chooser.setCurrentDirectory(f); +// chooser.setFileSelectionMode(JFileChooser.FILES_ONLY); +// chooser.setCurrentDirectory(new File(System +// .getProperty("user.home") +// + File.separator +// + "Desktop" + File.separator)); +// chooser.setSelectedFile(new File(FilenameUtils +// .getBaseName(url) +// + "." +// + FilenameUtils.getExtension(url))); +// chooser.setAcceptAllFileFilterUsed(false); +// int returnVal = chooser.showSaveDialog(null); +// if (returnVal == JFileChooser.APPROVE_OPTION) { +// FileUtils.copyFile(new File(pathSigned), +// chooser.getSelectedFile()); +// } + } else { + JOptionPane.showMessageDialog(null, "Ký số được hủy bỏ bởi người sử dụng!"); + } + } catch (MalformedURLException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } catch (Exception e) { + e.printStackTrace(); + } + + System.out + .println("================ End signPDF =================="); + return ""; + } + }); + + } + + public static void main(String agrs[]) { + try { + System.out.println(new EcoitApplet().getCertificate()); + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/CAAppletSimple/src/vn/ptit/project/encrypt/FormEncrypt.java b/CAAppletSimple/src/vn/ptit/project/encrypt/FormEncrypt.java index 9e06395..a4eccd8 100644 --- a/CAAppletSimple/src/vn/ptit/project/encrypt/FormEncrypt.java +++ b/CAAppletSimple/src/vn/ptit/project/encrypt/FormEncrypt.java @@ -22,12 +22,16 @@ import java.security.PublicKey; import java.security.spec.KeySpec; import java.util.Random; + import javax.crypto.BadPaddingException; import javax.crypto.Cipher; import javax.crypto.IllegalBlockSizeException; import javax.crypto.SecretKey; import javax.crypto.SecretKeyFactory; import javax.crypto.spec.DESedeKeySpec; + +import org.apache.commons.codec.binary.Hex; + import sun.misc.BASE64Decoder; import sun.misc.BASE64Encoder; import vn.ptit.project.utils.Convert; @@ -118,10 +122,10 @@ public static String authenticate(String request, PrivateKey priKey) { try { Cipher cipher = Cipher.getInstance("RSA/ECB/NoPadding"); cipher.init(Cipher.DECRYPT_MODE, priKey); - byte[] b = new BASE64Decoder().decodeBuffer(request); + byte[] b = Hex.decodeHex(request.toCharArray()); byte[] cipherText = cipher.doFinal(b); String data = new String(cipherText); - return data.substring(data.length() - 100); + return data; } catch (Exception e) { e.printStackTrace(); } diff --git a/CAAppletSimple/src/vn/ptit/project/utils/DateFromServer.java b/CAAppletSimple/src/vn/ptit/project/utils/DateFromServer.java new file mode 100644 index 0000000..01d5016 --- /dev/null +++ b/CAAppletSimple/src/vn/ptit/project/utils/DateFromServer.java @@ -0,0 +1,71 @@ +package vn.ptit.project.utils; + +import java.io.InputStream; +import java.io.OutputStream; +import java.net.HttpURLConnection; +import java.net.URL; +import java.security.MessageDigest; +import java.util.Date; + +import javax.swing.JOptionPane; + +import org.bouncycastle.asn1.ASN1InputStream; +import org.bouncycastle.asn1.tsp.TimeStampResp; +import org.bouncycastle.tsp.TSPAlgorithms; +import org.bouncycastle.tsp.TimeStampRequest; +import org.bouncycastle.tsp.TimeStampRequestGenerator; +import org.bouncycastle.tsp.TimeStampResponse; +import org.bouncycastle.tsp.TimeStampToken; + +public class DateFromServer { + public static boolean TIME_STAMP = false; + public static Date getDate() { + try { + String strURL = "http://ca.gov.vn/tsa"; + TimeStampToken ts = null; + MessageDigest md = null; + md = MessageDigest.getInstance("SHA-1"); + md.update("ABC".getBytes()); + byte[] digest = md.digest(); + OutputStream out; + TimeStampRequestGenerator regen = new TimeStampRequestGenerator(); + regen.setCertReq(true); + TimeStampRequest req = regen.generate(TSPAlgorithms.SHA1, digest); + byte request[] = req.getEncoded(); + URL url = new URL(strURL); + HttpURLConnection con = (HttpURLConnection) url.openConnection(); + con.setDoOutput(true); + con.setDoInput(true); + con.setRequestMethod("POST"); + + con.setRequestProperty("Content-type", + "application/timestamp-query"); + + con.setRequestProperty("Content-length", + String.valueOf(request.length)); + + out = con.getOutputStream(); + out.write(request); + out.flush(); + int j = con.getResponseCode(); + if (j != HttpURLConnection.HTTP_OK) { + JOptionPane.showMessageDialog(null, "ERROR!"); + throw new Exception("Received HTTP errof:" + + con.getResponseCode() + "-" + + con.getResponseMessage()); + } + InputStream in = con.getInputStream(); + TimeStampResp resp = TimeStampResp.getInstance(new ASN1InputStream( + in).readObject()); + TimeStampResponse response = new TimeStampResponse(resp); + response.validate(req); + ts = response.getTimeStampToken(); + System.out.println(ts.getTimeStampInfo().getTsa()); + return ts.getTimeStampInfo().getGenTime(); + } catch (Exception e) { + e.printStackTrace(); + return new Date(); + } + + } +} diff --git a/Integration With Zimbra 8/ajax/encryptEmail.jsp b/Integration With Zimbra 8/ajax/encryptEmail.jsp new file mode 100644 index 0000000..19adbab --- /dev/null +++ b/Integration With Zimbra 8/ajax/encryptEmail.jsp @@ -0,0 +1,14 @@ +<%@ page buffer="8kb" autoFlush="true"%> +<%@ page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%> +<%@ page session="false"%> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql"%> +<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> +<%@page import="asia.ecoit.security.Encrypt" %> +<% + String bodyText = request.getParameter("bodyText"); + String key = request.getParameter("key"); + Encrypt e = new Encrypt(); + out.print(e.encrypt3Des(bodyText, key)); + +%> \ No newline at end of file diff --git a/Integration With Zimbra 8/ajax/encryptKey.jsp b/Integration With Zimbra 8/ajax/encryptKey.jsp new file mode 100644 index 0000000..e06e18c --- /dev/null +++ b/Integration With Zimbra 8/ajax/encryptKey.jsp @@ -0,0 +1,31 @@ +<%@ page buffer="8kb" autoFlush="true"%> +<%@ page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%> +<%@ page session="false"%> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql"%> +<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> +<%@page import="asia.ecoit.security.Encrypt" %> +<% + String uid = request.getParameter("uid"); + pageContext.setAttribute("uid",uid); + String key = request.getParameter("randomKey"); +%> + + + + SELECT * FROM mailbox where comment='${uid}' and public_key!=''; + + +<% +try{ + String publicKey = (String) pageContext.getAttribute("public_key"); + Encrypt e = new Encrypt(); + String desKey = e.encrypt(key, publicKey); + out.print(desKey); +}catch(Exception ex){ + out.println(ex.toString()); +} + +%> \ No newline at end of file diff --git a/Integration With Zimbra 8/ajax/encryptMail.jsp b/Integration With Zimbra 8/ajax/encryptMail.jsp index 7f97f6d..3f9a31e 100644 --- a/Integration With Zimbra 8/ajax/encryptMail.jsp +++ b/Integration With Zimbra 8/ajax/encryptMail.jsp @@ -4,7 +4,7 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql"%> <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> -<%@page import="com.ecoit.asia.EcoitApplet" %> +<%@page import="asia.ecoit.security.Encrypt" %> <% String uid = request.getParameter("uid"); pageContext.setAttribute("uid",uid); @@ -13,18 +13,21 @@ + password="zgmWfc6K8sZEQ2aa8Ovygh2NVA" /> SELECT * FROM mailbox where comment='${uid}' and public_key!=''; <% +try{ String publicKey = (String) pageContext.getAttribute("public_key"); - publicKey = publicKey.substring(publicKey.indexOf("modulus")+9, publicKey.indexOf(" public exponent:")).trim(); Encrypt e = new Encrypt(); String key = e.generateRandomString(24); String desKey = e.encrypt(key, publicKey); out.print(desKey+"|"); out.print(e.encrypt3Des(bodyText, key)); + }catch(Exception ex){ + out.println(ex.toString()); + } %> \ No newline at end of file diff --git a/Integration With Zimbra 8/ajax/generateKey.jsp b/Integration With Zimbra 8/ajax/generateKey.jsp new file mode 100644 index 0000000..d688e40 --- /dev/null +++ b/Integration With Zimbra 8/ajax/generateKey.jsp @@ -0,0 +1,12 @@ +<%@ page buffer="8kb" autoFlush="true"%> +<%@ page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%> +<%@ page session="false"%> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql"%> +<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> +<%@page import="asia.ecoit.security.Encrypt" %> +<% + Encrypt e = new Encrypt(); + String key = e.generateRandomString(24); + out.print(key); +%> \ No newline at end of file diff --git a/Zimlet/com_zimbra_example_toolbarhook.js b/Zimlet/com_zimbra_example_toolbarhook.js index 9bae7cc..eb675dd 100644 --- a/Zimlet/com_zimbra_example_toolbarhook.js +++ b/Zimlet/com_zimbra_example_toolbarhook.js @@ -15,23 +15,25 @@ var deployJava=function(){var l={core:["id","class","title","style"],i18n:["lang","dir"],events:["onclick","ondblclick","onmousedown","onmouseup","onmouseover","onmousemove","onmouseout","onkeypress","onkeydown","onkeyup"],applet:["codebase","code","name","archive","object","width","height","alt","align","hspace","vspace"],object:["classid","codebase","codetype","data","type","archive","declare","standby","height","width","usemap","name","tabindex","align","border","hspace","vspace"]};var b=l.object.concat(l.core,l.i18n,l.events);var m=l.applet.concat(l.core);function g(o){if(!d.debug){return}if(console.log){console.log(o)}else{alert(o)}}function k(p,o){if(p==null||p.length==0){return true}var r=p.charAt(p.length-1);if(r!="+"&&r!="*"&&(p.indexOf("_")!=-1&&r!="_")){p=p+"*";r="*"}p=p.substring(0,p.length-1);if(p.length>0){var q=p.charAt(p.length-1);if(q=="."||q=="_"){p=p.substring(0,p.length-1)}}if(r=="*"){return(o.indexOf(p)==0)}else{if(r=="+"){return p<=o}}return false}function e(){var o="//java.com/js/webstart.png";try{return document.location.protocol.indexOf("http")!=-1?o:"http:"+o}catch(p){return"http:"+o}}function n(p){var o="http://java.com/dt-redirect";if(p==null||p.length==0){return o}if(p.charAt(0)=="&"){p=p.substring(1,p.length)}return o+"?"+p}function j(q,p){var o=q.length;for(var r=0;r";var x=true;if(null==w||typeof w!="object"){w=new Object()}for(var p in r){if(!c(p)){w[p]=r[p]}else{o+=(" "+p+'="'+r[p]+'"');if(p=="code"){x=false}}}var v=false;for(var u in w){if(u=="codebase_lookup"){v=true}if(u=="object"||u=="java_object"||u=="java_code"){x=false}q+=''}if(!v){q+=''}if(x){o+=(' code="dummy"')}o+=">";document.write(o+"\n"+q+"\n"+t)},versionCheck:function(p){var v=0;var x="^(\\d+)(?:\\.(\\d+)(?:\\.(\\d+)(?:_(\\d+))?)?)?(\\*|\\+)?$";var y=p.match(x);if(y!=null){var r=false;var u=false;var q=new Array();for(var t=1;t'+"<"+'PARAM name="launchjnlp" value="'+r+'"'+">"+"<"+'PARAM name="docbase" value="'+u+'"'+">"+"<"+"/"+"object"+">"}else{if(p=="Netscape Family"){q="<"+'embed type="application/x-java-applet;jpi-version='+this.firefoxJavaVersion+'" '+'width="0" height="0" '+'launchjnlp="'+r+'"'+'docbase="'+u+'"'+" />"}}if(document.body=="undefined"||document.body==null){document.write(q);document.location=u}else{var t=document.createElement("div");t.id="div1";t.style.position="relative";t.style.left="-10000px";t.style.margin="0px auto";t.className="dynamicDiv";t.innerHTML=q;document.body.appendChild(t)}},createWebStartLaunchButtonEx:function(q,p){if(this.returnPage==null){this.returnPage=q}var o="javascript:deployJava.launchWebStartApplication('"+q+"');";document.write("<"+'a href="'+o+"\" onMouseOver=\"window.status=''; "+'return true;"><'+"img "+'src="'+this.launchButtonPNG+'" '+'border="0" /><'+"/"+"a"+">")},createWebStartLaunchButton:function(q,p){if(this.returnPage==null){this.returnPage=q}var o="javascript:"+"if (!deployJava.isWebStartInstalled(""+p+"")) {"+"if (deployJava.installLatestJRE()) {"+"if (deployJava.launch(""+q+"")) {}"+"}"+"} else {"+"if (deployJava.launch(""+q+"")) {}"+"}";document.write("<"+'a href="'+o+"\" onMouseOver=\"window.status=''; "+'return true;"><'+"img "+'src="'+this.launchButtonPNG+'" '+'border="0" /><'+"/"+"a"+">")},launch:function(o){document.location=o;return true},isPluginInstalled:function(){var o=this.getPlugin();if(o&&o.jvms){return true}else{return false}},isAutoUpdateEnabled:function(){if(this.isPluginInstalled()){return this.getPlugin().isAutoUpdateEnabled()}return false},setAutoUpdateEnabled:function(){if(this.isPluginInstalled()){return this.getPlugin().setAutoUpdateEnabled()}return false},setInstallerType:function(o){this.installType=o;if(this.isPluginInstalled()){return this.getPlugin().setInstallerType(o)}return false},setAdditionalPackages:function(o){if(this.isPluginInstalled()){return this.getPlugin().setAdditionalPackages(o)}return false},setEarlyAccess:function(o){this.EAInstallEnabled=o},isPlugin2:function(){if(this.isPluginInstalled()){if(this.versionCheck("1.6.0_10+")){try{return this.getPlugin().isPlugin2()}catch(o){}}}return false},allowPlugin:function(){this.getBrowser();var o=("Safari"!=this.browserName2&&"Opera"!=this.browserName2);return o},getPlugin:function(){this.refresh();var o=null;if(this.allowPlugin()){o=document.getElementById("deployJavaPlugin")}return o},compareVersionToPattern:function(v,p,r,t){if(v==undefined||p==undefined){return false}var w="^(\\d+)(?:\\.(\\d+)(?:\\.(\\d+)(?:_(\\d+))?)?)?$";var x=v.match(w);if(x!=null){var u=0;var y=new Array();for(var q=1;qp[q]){return true}}}return true}else{for(var q=0;q "+o);if((o.indexOf("msie")!=-1)&&(o.indexOf("opera")==-1)){this.browserName="MSIE";this.browserName2="MSIE"}else{if(o.indexOf("trident")!=-1||o.indexOf("Trident")!=-1){this.browserName="MSIE";this.browserName2="MSIE"}else{if(o.indexOf("iphone")!=-1){this.browserName="Netscape Family";this.browserName2="iPhone"}else{if((o.indexOf("firefox")!=-1)&&(o.indexOf("opera")==-1)){this.browserName="Netscape Family";this.browserName2="Firefox"}else{if(o.indexOf("chrome")!=-1){this.browserName="Netscape Family";this.browserName2="Chrome"}else{if(o.indexOf("safari")!=-1){this.browserName="Netscape Family";this.browserName2="Safari"}else{if((o.indexOf("mozilla")!=-1)&&(o.indexOf("opera")==-1)){this.browserName="Netscape Family";this.browserName2="Other"}else{if(o.indexOf("opera")!=-1){this.browserName="Netscape Family";this.browserName2="Opera"}else{this.browserName="?";this.browserName2="unknown"}}}}}}}}g("[getBrowser()] Detected browser name:"+this.browserName+", "+this.browserName2)}return this.browserName},testUsingActiveX:function(o){var q="JavaWebStart.isInstalled."+o+".0";if(typeof ActiveXObject=="undefined"||!ActiveXObject){g("[testUsingActiveX()] Browser claims to be IE, but no ActiveXObject object?");return false}try{return(new ActiveXObject(q)!=null)}catch(p){return false}},testForMSVM:function(){var p="{08B0E5C0-4FCB-11CF-AAA5-00401C608500}";if(typeof oClientCaps!="undefined"){var o=oClientCaps.getComponentVersion(p,"ComponentID");if((o=="")||(o=="5,0,5000,0")){return false}else{return true}}else{return false}},testUsingMimeTypes:function(p){if(!navigator.mimeTypes){g("[testUsingMimeTypes()] Browser claims to be Netscape family, but no mimeTypes[] array?");return false}for(var q=0;qo[0]){return true}if(p[0]o[1]){return true}if(p[1]o[2]){return true}if(p[2]'+"<"+"/"+"object"+">")}else{if(o=="Netscape Family"&&this.allowPlugin()){this.writeEmbedTag()}}},refresh:function(){navigator.plugins.refresh(false);var o=this.getBrowser();if(o=="Netscape Family"&&this.allowPlugin()){var p=document.getElementById("deployJavaPlugin");if(p==null){this.writeEmbedTag()}}},writeEmbedTag:function(){var o=false;if(navigator.mimeTypes!=null){for(var p=0;p