diff options
author | gregor <gregor@d688527b-c9ab-4aba-bd8d-4036d912da1d> | 2003-11-11 22:36:36 +0000 |
---|---|---|
committer | gregor <gregor@d688527b-c9ab-4aba-bd8d-4036d912da1d> | 2003-11-11 22:36:36 +0000 |
commit | 643b4096cdd0f0ed98f21c9b5b681ed89bcb08dc (patch) | |
tree | 9e750c9103ad923b291820bc85fcbd669c2e7900 /spss.test/src/testgenerator/VXResponseBean.java | |
parent | bc620256eb9b4dc6a33244b1105e58773358dbe6 (diff) | |
download | moa-id-spss-643b4096cdd0f0ed98f21c9b5b681ed89bcb08dc.tar.gz moa-id-spss-643b4096cdd0f0ed98f21c9b5b681ed89bcb08dc.tar.bz2 moa-id-spss-643b4096cdd0f0ed98f21c9b5b681ed89bcb08dc.zip |
Erstellt.tags/Build-1.2.0.D01-svn
git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@51 d688527b-c9ab-4aba-bd8d-4036d912da1d
Diffstat (limited to 'spss.test/src/testgenerator/VXResponseBean.java')
-rw-r--r-- | spss.test/src/testgenerator/VXResponseBean.java | 180 |
1 files changed, 180 insertions, 0 deletions
diff --git a/spss.test/src/testgenerator/VXResponseBean.java b/spss.test/src/testgenerator/VXResponseBean.java new file mode 100644 index 000000000..bbdf02bbc --- /dev/null +++ b/spss.test/src/testgenerator/VXResponseBean.java @@ -0,0 +1,180 @@ + +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 = + "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + + "<VerifyXMLSignatureResponse xmlns=\"http://reference.e-government.gv.at/namespace/moa/20020822#\" >\n" + + " <SignerInfo>\n" + + " <dsig:X509Data xmlns:dsig=\"http://www.w3.org/2000/09/xmldsig#\">\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 " <dsig:X509Certificate>" + + (cert) + + "</dsig:X509Certificate>\n"; + + } + + + public String getSubjectDN() throws Exception { + return " <dsig:X509SubjectName>" + + ((Name) cert.getSubjectDN()).getRFC2253String() + + "</dsig:X509SubjectName>\n"; + } + public String getIssuerDN() throws Exception { + + return " <dsig:X509IssuerName>" + + ((Name)cert.getIssuerDN()).getRFC2253String() + + "</dsig:X509IssuerName>\n"; + } + + public String getSerialNumber() throws Exception { + + return " <dsig:X509SerialNumber>" + + cert.getSerialNumber() + + "</dsig:X509SerialNumber>\n"; + } + + public String getFooterSignatureCheck(String signatureCheckCode, String certificateCheckCode) + { + String res = null; + res = " </HashInputData>\n" + + " <SignatureCheck>\n" + + " <Code>" + signatureCheckCode + "</Code>\n" + + " </SignatureCheck>\n" + + " <CertificateCheck>\n" + + " <Code>"+certificateCheckCode+"</Code>\n" + + " </CertificateCheck>\n" + + "</VerifyXMLSignatureResponse>"; + + return res; + + } + public String getFooterXMLDSIGManifestCheck(String xmlDSIGManifestCheckCode , String certificateCheckCode) + { + String res = null; +/* res = "</XMLContent>\n" + + " </HashInputData>\n" + + " <XMLDSIGManifestCheck>\n" + + " <Code>" + xmlDSIGManifestCheckCode + "</Code>\n" + + " </XMLDSIGManifestCheck>\n" + + " <CertificateCheck>\n" + + " <Code>"+certificateCheckCode+"</Code>\n" + + " </CertificateCheck>\n" + + "</VerifyXMLSignatureResponse>"; +*/ + res = " <XMLDSIGManifestCheck>\n" + + " <Code>" + xmlDSIGManifestCheckCode + "</Code>\n" + + " </XMLDSIGManifestCheck>\n" + + " <CertificateCheck>\n" + + " <Code>"+certificateCheckCode+"</Code>\n" + + " </CertificateCheck>\n" + + "</VerifyXMLSignatureResponse>"; + + return res; + + } +public String createXMLDSIGManifestCheck(String xmlDSIGManifestCheckCode, String failedReference, String referringSigRefData) + { + + if(failedReference != null && !failedReference.trim().equals("")) + { + String res = null; + res = " <XMLDSIGManifestCheck>\n" + + " <Code>" + xmlDSIGManifestCheckCode + "</Code>\n" + + " <Info><FailedReference>" + failedReference + + "</FailedReference><ReferringSigReference>" + referringSigRefData + "</ReferringSigReference>" + + " </Info>\n" + + " </XMLDSIGManifestCheck>\n"; + + return res; + } + else + { + String res = null; + res = " <XMLDSIGManifestCheck>\n" + + " <Code>" + xmlDSIGManifestCheckCode + "</Code>\n" + + " <Info>" + failedReference + + " <ReferringSigReference>" + referringSigRefData + "</ReferringSigReference>" + + " </Info>\n" + + " </XMLDSIGManifestCheck>\n"; + + return res; + } + + } + +public String createSignatureCheck(String signatureCheckCode) + { + String res = null; + res = " <SignatureCheck>\n" + + " <Code>" + signatureCheckCode + "</Code>\n" + + " </SignatureCheck>\n"; + return res; + + } +public String createSignatureManifestCheck(String signatureCheckCode) + { + String res = null; + res = " <SignatureManifestCheck>\n" + + " <Code>" + signatureCheckCode + "</Code>\n" + + " </SignatureManifestCheck>\n"; + return res; + + } + +public String createSignatureManifestCheck(String signatureCheckCode,String info) + { + String res = null; + res = " <SignatureManifestCheck>\n" + + " <Code>" + signatureCheckCode + "</Code>\n" + info + + " </SignatureManifestCheck>\n"; + return res; + + } +public String createCertificateCheck(String certificateCheckCode) + { + String res = null; + res = " <CertificateCheck>\n" + + " <Code>"+certificateCheckCode+"</Code>\n" + + " </CertificateCheck>\n"; + return res; + } +private InputStream getHttpInputStream(String url) throws Exception + { + + return ((HttpURLConnection)new URL(url).openConnection()).getInputStream(); + } + +} |