package testgenerator; import java.io.*; import java.net.HttpURLConnection; import java.net.URL; import iaik.asn1.structures.Name; import iaik.x509.X509Certificate; /** * @author KNIRSCHS * * To change this generated comment edit the template variable "typecomment": * Window>Preferences>Java>Templates. * To enable and disable the creation of type comments go to * Window>Preferences>Java>Code Generation. */ public class VXResponseBean { private X509Certificate cert = null; /** * Constructor for VXResponseBean. */ public String getHeader() { String result = "\n" + "\n" + " \n" + " \n"; return result; } public void init(String Filename) throws Exception { if (cert == null) { InputStream cfile = getHttpInputStream(Filename); cert = new iaik.x509.X509Certificate(cfile); } } public String getCert() throws Exception { return " " + (cert) + "\n"; } public String getSubjectDN() throws Exception { return " " + ((Name) cert.getSubjectDN()).getRFC2253String() + "\n"; } public String getIssuerDN() throws Exception { return " " + ((Name)cert.getIssuerDN()).getRFC2253String() + "\n"; } public String getSerialNumber() throws Exception { return " " + cert.getSerialNumber() + "\n"; } public String getFooterSignatureCheck(String signatureCheckCode, String certificateCheckCode) { String res = null; res = " \n" + " \n" + " " + signatureCheckCode + "\n" + " \n" + " \n" + " "+certificateCheckCode+"\n" + " \n" + ""; return res; } public String getFooterXMLDSIGManifestCheck(String xmlDSIGManifestCheckCode , String certificateCheckCode) { String res = null; /* res = "\n" + " \n" + " \n" + " " + xmlDSIGManifestCheckCode + "\n" + " \n" + " \n" + " "+certificateCheckCode+"\n" + " \n" + ""; */ res = " \n" + " " + xmlDSIGManifestCheckCode + "\n" + " \n" + " \n" + " "+certificateCheckCode+"\n" + " \n" + ""; return res; } public String createXMLDSIGManifestCheck(String xmlDSIGManifestCheckCode, String failedReference, String referringSigRefData) { if(failedReference != null && !failedReference.trim().equals("")) { String res = null; res = " \n" + " " + xmlDSIGManifestCheckCode + "\n" + " " + failedReference + "" + referringSigRefData + "" + " \n" + " \n"; return res; } else { String res = null; res = " \n" + " " + xmlDSIGManifestCheckCode + "\n" + " " + failedReference + " " + referringSigRefData + "" + " \n" + " \n"; return res; } } public String createSignatureCheck(String signatureCheckCode) { String res = null; res = " \n" + " " + signatureCheckCode + "\n" + " \n"; return res; } public String createSignatureManifestCheck(String signatureCheckCode) { String res = null; res = " \n" + " " + signatureCheckCode + "\n" + " \n"; return res; } public String createSignatureManifestCheck(String signatureCheckCode,String info) { String res = null; res = " \n" + " " + signatureCheckCode + "\n" + info + " \n"; return res; } public String createCertificateCheck(String certificateCheckCode) { String res = null; res = " \n" + " "+certificateCheckCode+"\n" + " \n"; return res; } private InputStream getHttpInputStream(String url) throws Exception { return ((HttpURLConnection)new URL(url).openConnection()).getInputStream(); } }