From 643b4096cdd0f0ed98f21c9b5b681ed89bcb08dc Mon Sep 17 00:00:00 2001 From: gregor Date: Tue, 11 Nov 2003 22:36:36 +0000 Subject: Erstellt. git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@51 d688527b-c9ab-4aba-bd8d-4036d912da1d --- spss.test/src/testgenerator/TestGeneratorVC0.java | 1057 +++++++++++++++++++++ 1 file changed, 1057 insertions(+) create mode 100644 spss.test/src/testgenerator/TestGeneratorVC0.java (limited to 'spss.test/src/testgenerator/TestGeneratorVC0.java') diff --git a/spss.test/src/testgenerator/TestGeneratorVC0.java b/spss.test/src/testgenerator/TestGeneratorVC0.java new file mode 100644 index 000000000..f54689875 --- /dev/null +++ b/spss.test/src/testgenerator/TestGeneratorVC0.java @@ -0,0 +1,1057 @@ +package testgenerator; + +import iaik.asn1.ASN1Object; +import iaik.asn1.CodingException; +import iaik.asn1.DerCoder; +import iaik.asn1.ObjectID; +import iaik.asn1.structures.AlgorithmID; +import iaik.asn1.structures.Attribute; +import iaik.asn1.structures.ChoiceOfTime; +import iaik.asn1.structures.Name; +import iaik.cms.CMSException; +import iaik.cms.ContentInfoStream; +import iaik.cms.SignedDataStream; +import iaik.cms.SignerInfo; +import iaik.security.random.SecRandom; +import iaik.utils.StreamCopier; +import iaik.x509.X509Certificate; + +import java.io.BufferedInputStream; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.security.PrivateKey; +import java.security.Provider; +import java.security.SecureRandom; +import java.security.Security; +import java.security.SignatureException; + +import sun.misc.BASE64Encoder; + + +/** + * @author Administrator + * + * 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 TestGeneratorVC0 extends TestCases { + + String datadirectory = "data/VC0/"; + String datadirectory_l = "data/LVC"; + + public String defaultblock = + ""+ + ""+ + "2003-04-04T09:30:47-05:00"+ + ""+ + ""+ + ""+ + "text/plain"+ + "anyURI"+ + ""+ + ""+ + "RGllcyBzaW5kIFRlc3RkYXRlbg0KMi4gWmVpbGUNCjMuIFplaWxlDQphdXM="+ + ""+ + ""+ + "TrustProfile1"+ + ""; + + public String defaultresponse = + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""; + + public String defaultresponse2 = + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""+ + ""; + + /* + + + + + + */ + + public String b64_der_data = null; + public String b64_der_data_two = null; + public String b64_der_data_exp = null; + public String b64_der_data_exp_two = null; + public String b64_der_data_max = null; + + public String b64_der_data_1kb = null; + public String b64_der_data_10kb = null; + public String b64_der_data_100kb = null; + public String b64_der_data_1mb = null; + public String b64_der_data_10mb = null; + + public String cert_file_data = null; + public String cert_max_file_data = null; + public String cert_root_file_data = null; + + + public String fileprefix = null; + public String filesuffix = null; + + // signing certificate of user 2 + X509Certificate user2_sign; + // signing private key of user 2 + PrivateKey user2_sign_pk; + + // encryption certificate of user 2 + X509Certificate user2_crypt; + // encryption private key of user 2 + PrivateKey user2_crypt_pk; + // a certificate chain containing the user certs + CA + + X509Certificate[] certificates; + // secure random number generator + SecureRandom random; + + public TestGeneratorVC0() throws Exception + { + super(); + // Set config properties + configuration_.setProperty("TestClass", "TestGeneratorVC0"); + + + configuration_.setProperty( + "PKCS12file_maxmustermann", + (configuration_.getProperty("baseDir") + "/resources/Max_Mustermann (max).p12")); + + configuration_.setProperty("PKCS12password_maxmustermann", "max"); + + configuration_.setProperty( + "CERT_maxmustermann", + (configuration_.getProperty("baseDir") + "resources/Max_Mustermann.cer")); + + configuration_.setProperty( + "CERT_ROOT", + (configuration_.getProperty("baseDir") + "resources/IAIKRootMusterbehoerde.cer")); + + Provider [] list = Security.getProviders(); + for(int counter=0;counter"+ + " "+ + " "+ + " "+ + " "+ + " "+ + " "+ + " "+ + " "+ + " "+ + " "+ + ""; + + FileOutputStream fos = new FileOutputStream(file); + fos.write(config.getBytes()); + fos.flush(); + fos.close(); + + fileprefix = configuration_.getProperty("baseDir")+ datadirectory + configuration_.getProperty("TestClass") + "."; + filesuffix = ".xml"; + + } + + public static void main(String[] args) throws Exception { + TestGeneratorVC0 testcase = new TestGeneratorVC0(); + + testcase.createConfig(); + testcase.create001(); + testcase.create002(); + testcase.create003(); + testcase.create004(); + testcase.create005(); + testcase.create006(); + testcase.create007(); + testcase.create008(); + testcase.create009(); + testcase.create010(); + //testcase.create011(); + testcase.create012(); + + testcase.create051(); + testcase.create052(); + //testcase.create053(); + testcase.create054(); + testcase.create055(); + testcase.create056(); + testcase.create057(); + testcase.create058(); + + //testcase.createL00(); + + } + + public void createL00() throws Exception { + createL001("1kb"); + createL001("10kb"); + createL001("20kb"); + createL001("50kb"); + createL001("100kb"); + createL001("500kb"); + createL001("1mb"); + createL001("10mb"); + } + + public void createL001(String filename) throws Exception + { + String TestNumber = "001"; + + String reqFile = configuration_.getProperty("baseDir")+ datadirectory_l+filename+"/" + configuration_.getProperty("TestClass") + "." + TestNumber + ".Req.xml"; + + String req = replaceString(defaultblock,"",getCMSData(filename)); + req = replaceString(req,"",""); + req = replaceStringAll(req,"anyURI",configuration_.getProperty("webbaseDir") + "resources/"+filename+".txt"); + req = replaceString(req, + "RGllcyBzaW5kIFRlc3RkYXRlbg0KMi4gWmVpbGUNCjMuIFplaWxlDQphdXM=", + ""); + + writeFile(reqFile,req); + + String resFile = configuration_.getProperty("baseDir")+ datadirectory_l+filename+"/" + configuration_.getProperty("TestClass") + "." + TestNumber + ".Res.xml"; + + String res = replaceString(defaultresponse,"",this.X509name); + res = replaceString(res,"",this.X509number.toString()); + res = replaceString(res,"",this.X509sub); + res = replaceString(res,"","0"); + res = replaceString(res,"","0"); + res = replaceString(res,"",cert_file_data); + res = replaceString(res,"",""); + //res = replaceString(res,"",""); + + + writeFile(resFile,res); + + + } + + public void create001() throws Exception + { + String TestNumber = "001"; + String reqFile = fileprefix + TestNumber + ".Req"+filesuffix; + + String req = replaceString(defaultblock,"",b64_der_data_exp); + req = replaceStringAll(req,"anyURI",configuration_.getProperty("webbaseDir") + "resources/testDaten.txt"); + + writeFile(reqFile,req); + + String resFile = fileprefix + TestNumber + ".Res"+filesuffix; + + /*CreatePKCSSignature cpkcs = new CreatePKCSSignature(); + cpkcs.init(); + cpkcs.setCanoncialization(canAlgCanXML); + cpkcs.createReference(false,"file:/"+configuration_.getProperty("baseDir")+"resources/testDaten.txt"); + cpkcs.setKeyInformation(); + + Document doc = cpkcs.returnSig(); + + String output = makeOutputFile(doc,"",readFile(configuration_.getProperty("baseDir")+"resources/testDaten.txt")+""); + + writeFile(resFile, output);*/ + + String res = replaceString(defaultresponse,"",this.X509name); + res = replaceString(res,"",this.X509number.toString()); + res = replaceString(res,"",this.X509sub); + res = replaceString(res,"","0"); + res = replaceString(res,"","0"); + res = replaceString(res,"",cert_file_data); + res = replaceString(res,"",""); + //res = replaceString(res,"",""); + + + writeFile(resFile,res); + + + } + + public void create002() throws Exception + { + String TestNumber = "002"; + String reqFile = fileprefix + TestNumber + ".Req"+filesuffix; + + String req = replaceString(defaultblock,"",b64_der_data_exp_two); + req = replaceStringAll(req,"anyURI",configuration_.getProperty("webbaseDir") + "resources/testDaten.txt"); + req = replaceString(req, + "Signatories=\"1\"", + "Signatories=\"1 2\""); + + + writeFile(reqFile,req); + + String resFile = fileprefix + TestNumber + ".Res"+filesuffix; + + String res = replaceStringAll(defaultresponse2,"",this.X509name); + res = replaceStringAll(res,"",this.X509number.toString()); + res = replaceStringAll(res,"",this.X509sub); + res = replaceStringAll(res,"","0"); + res = replaceStringAll(res,"","0"); + res = replaceStringAll(res,"",cert_file_data); + //res = replaceString(res,"",""); + writeFile(resFile,res); + } + + public void create003() throws Exception + { + String TestNumber = "003"; + String reqFile = fileprefix + TestNumber + ".Req"+filesuffix; + + String req = replaceString(defaultblock,"",b64_der_data_exp); + req = replaceStringAll(req,"anyURI",configuration_.getProperty("webbaseDir") + "resources/testDaten.txt"); + req = replaceString(req, + "Signatories=\"1\"", + "Signatories=\"all\""); + + + writeFile(reqFile,req); + + String resFile = fileprefix + TestNumber + ".Res"+filesuffix; + + String res = replaceString(defaultresponse,"",this.X509name); + res = replaceString(res,"",this.X509number.toString()); + res = replaceString(res,"",this.X509sub); + res = replaceString(res,"","0"); + res = replaceString(res,"","0"); + res = replaceString(res,"",cert_file_data); + res = replaceString(res,"",""); + writeFile(resFile,res); + } + + public void create004() throws Exception + { + String TestNumber = "004"; + String reqFile = fileprefix + TestNumber + ".Req"+filesuffix; + + String req = replaceString(defaultblock,"",b64_der_data_exp); + req = replaceStringAll(req,"anyURI",configuration_.getProperty("webbaseDir") + "resources/testDaten.txt"); + req = replaceString(req, + "2003-04-04T09:30:47-05:00", + ""); + + writeFile(reqFile,req); + + String resFile = fileprefix + TestNumber + ".Res"+filesuffix; + + String res = replaceString(defaultresponse,"",this.X509name); + res = replaceString(res,"",this.X509number.toString()); + res = replaceString(res,"",this.X509sub); + res = replaceString(res,"","0"); + res = replaceString(res,"","0"); + res = replaceString(res,"",cert_file_data); + res = replaceString(res,"",""); + writeFile(resFile,res); + } + + public void create005() throws Exception + { + String TestNumber = "005"; + String reqFile = fileprefix + TestNumber + ".Req"+filesuffix; + + String req = replaceString(defaultblock,"",b64_der_data_exp); + req = replaceStringAll(req,"anyURI",configuration_.getProperty("webbaseDir") + "resources/testDaten.txt"); + req = replaceString(req, + "2003-04-04T09:30:47-05:00", + "2003-04-04T09:30:47-05:00"); + + writeFile(reqFile,req); + + String resFile = fileprefix + TestNumber + ".Res"+filesuffix; + + String res = replaceString(defaultresponse,"",this.X509name); + res = replaceString(res,"",this.X509number.toString()); + res = replaceString(res,"",this.X509sub); + res = replaceString(res,"","0"); + res = replaceString(res,"","0"); + res = replaceString(res,"",cert_file_data); + res = replaceString(res,"",""); + writeFile(resFile,res); + } + + public void create006() throws Exception + { + String TestNumber = "006"; + String reqFile = fileprefix + TestNumber + ".Req"+filesuffix; + + String req = replaceString(defaultblock,"",b64_der_data); + req = replaceStringAll(req,"anyURI",configuration_.getProperty("webbaseDir") + "resources/testDaten.txt"); + req = replaceString(req, + ""+ + ""+ + "text/plain"+ + ""+configuration_.getProperty("webbaseDir") + "resources/testDaten.txt"+ + ""+ + ""+ + "RGllcyBzaW5kIFRlc3RkYXRlbg0KMi4gWmVpbGUNCjMuIFplaWxlDQphdXM="+ + ""+ + "", + ""); + + //req = replaceString(defaultblock, + + writeFile(reqFile,req); + + String resFile = fileprefix + TestNumber + ".Res"+filesuffix; + + String res = replaceString(defaultresponse,"",this.X509name); + res = replaceString(res,"",this.X509number.toString()); + res = replaceString(res,"",this.X509sub); + res = replaceString(res,"","0"); + res = replaceString(res,"","0"); + res = replaceString(res,"",cert_file_data); + res = replaceString(res,"",""); + writeFile(resFile,res); + } + + public void create007() throws Exception + { + String TestNumber = "007"; + String reqFile = fileprefix + TestNumber + ".Req"+filesuffix; + + String req = replaceString(defaultblock,"",b64_der_data_exp); + req = replaceStringAll(req,"anyURI",configuration_.getProperty("webbaseDir") + "resources/testDaten.txt"); + req = replaceString(req, + ""+ + "text/plain"+ + ""+configuration_.getProperty("webbaseDir") + "resources/testDaten.txt"+ + "", + ""); + + writeFile(reqFile,req); + + String resFile = fileprefix + TestNumber + ".Res"+filesuffix; + + String res = replaceString(defaultresponse,"",this.X509name); + res = replaceString(res,"",this.X509number.toString()); + res = replaceString(res,"",this.X509sub); + res = replaceString(res,"","0"); + res = replaceString(res,"","0"); + res = replaceString(res,"",cert_file_data); + res = replaceString(res,"",""); + writeFile(resFile,res); + } + + public void create008() throws Exception + { + String TestNumber = "008"; + String reqFile = fileprefix + TestNumber + ".Req"+filesuffix; + + String req = replaceString(defaultblock,"",b64_der_data_exp); + req = replaceStringAll(req,"anyURI",configuration_.getProperty("webbaseDir") + "resources/testDaten.txt"); + + writeFile(reqFile,req); + + String resFile = fileprefix + TestNumber + ".Res"+filesuffix; + + String res = replaceString(defaultresponse,"",this.X509name); + res = replaceString(res,"",this.X509number.toString()); + res = replaceString(res,"",this.X509sub); + res = replaceString(res,"","0"); + res = replaceString(res,"","0"); + res = replaceString(res,"",cert_file_data); + res = replaceString(res,"",""); + writeFile(resFile,res); + } + + public void create009() throws Exception + { + String TestNumber = "009"; + String reqFile = fileprefix + TestNumber + ".Req"+filesuffix; + + String req = replaceString(defaultblock,"",b64_der_data_exp); + req = replaceString(req,"",""); + req = replaceStringAll(req,"anyURI",configuration_.getProperty("webbaseDir") + "resources/testDaten.txt"); + req = replaceString(req, + "RGllcyBzaW5kIFRlc3RkYXRlbg0KMi4gWmVpbGUNCjMuIFplaWxlDQphdXM=", + ""); + + writeFile(reqFile,req); + + String resFile = fileprefix + TestNumber + ".Res"+filesuffix; + + String res = replaceString(defaultresponse,"",this.X509name); + res = replaceString(res,"",this.X509number.toString()); + res = replaceString(res,"",this.X509sub); + res = replaceString(res,"","0"); + res = replaceString(res,"","0"); + res = replaceString(res,"",cert_file_data); + res = replaceString(res,"",""); + writeFile(resFile,res); + } + + public void create011() throws Exception + { + String TestNumber = "011"; + String reqFile = fileprefix + TestNumber + ".Req"+filesuffix; + + String req = replaceString(defaultblock,"",readFile(configuration_.getProperty("baseDir") + "resources/VC0.011.cms.ber.b64.txt")); + req = replaceStringAll(req,"anyURI",configuration_.getProperty("webbaseDir") + "resources/testDaten.txt"); + req = replaceString(req, + ""+ + ""+ + "text/plain"+ + ""+configuration_.getProperty("webbaseDir") + "resources/testDaten.txt"+ + ""+ + ""+ + "RGllcyBzaW5kIFRlc3RkYXRlbg0KMi4gWmVpbGUNCjMuIFplaWxlDQphdXM="+ + ""+ + "", + ""); + + writeFile(reqFile,req); + + String resFile = fileprefix + TestNumber + ".Res"+filesuffix; + + String res = replaceString(defaultresponse,"","CN=a-sign-TEST-Premium-Enc-01,OU=a-sign-TEST-Premium-Enc-01,O=A-Trust Ges. f. Sicherheitssysteme im elektr. Datenverkehr GmbH,C=AT"); + res = replaceString(res,"","6455"); + res = replaceString(res,"","Seriennummer=790187461633,G=Testperson MOA4,SN=BRZ,CN=Testperson MOA4 BRZ,C=AT"); + res = replaceString(res,"","0"); + res = replaceString(res,"","0"); + res = replaceString(res,"",cert_file_data); + res = replaceString(res,"",""); + res = replaceString(res, + "", + ""+ + ""); + + + writeFile(resFile,res); + } + + public void create012() throws Exception + { + String TestNumber = "012"; + String reqFile = fileprefix + TestNumber + ".Req"+filesuffix; + + BufferedInputStream bis = new BufferedInputStream(new FileInputStream(configuration_.getProperty("CERT_maxmustermann"))); + iaik.x509.X509Certificate cert = new iaik.x509.X509Certificate(bis); + X509name = ((Name)(cert.getIssuerDN())).getRFC2253String(); + X509number = cert.getSerialNumber(); + X509hash = new String(cert.getFingerprintSHA()); + X509sub = ((Name)(cert.getSubjectDN())).getRFC2253String(); + + String m = "This is a message"; + System.out.println("*"+m+"*"); + byte[] message = m.getBytes(); + + ASN1Object obj = null; + obj = createSignedCMSData(message, SignedDataStream.IMPLICIT,false,"PKCS12file_maxmustermann","PKCS12password_maxmustermann","CERT_maxmustermann"); + byte[] sig = DerCoder.encode(obj); + writeFileBinary("testimplmax.ber",sig); + b64_der_data_max = (new BASE64Encoder()).encode(sig); + + + String req = replaceString(defaultblock,"",b64_der_data_max); + + req = replaceString(req, + ""+ + ""+ + "text/plain"+ + "anyURI"+ + ""+ + ""+ + "RGllcyBzaW5kIFRlc3RkYXRlbg0KMi4gWmVpbGUNCjMuIFplaWxlDQphdXM="+ + ""+ + "", + ""); + + //req = replaceStringAll(req,"anyURI",configuration_.getProperty("webbaseDir") + "resources/testDaten.txt"); + + writeFile(reqFile,req); + + String resFile = fileprefix + TestNumber + ".Res"+filesuffix; + + /*CreatePKCSSignature cpkcs = new CreatePKCSSignature(); + cpkcs.init(); + cpkcs.setCanoncialization(canAlgCanXML); + cpkcs.createReference(false,"file:/"+configuration_.getProperty("baseDir")+"resources/testDaten.txt"); + cpkcs.setKeyInformation(); + + Document doc = cpkcs.returnSig(); + + String output = makeOutputFile(doc,"",readFile(configuration_.getProperty("baseDir")+"resources/testDaten.txt")+""); + + writeFile(resFile, output);*/ + + + String res = replaceString(defaultresponse,"",X509name); + res = replaceString(res,"",X509number.toString()); + res = replaceString(res,"",X509sub); + res = replaceString(res,"","0"); + res = replaceString(res,"","0"); + res = replaceString(res,"",cert_max_file_data); + res = replaceString(res,"",""); + res = replaceString(res, + "", + ""+ + "Musterbehörde"+ + //"Musterbehörde"+ + ""+ + ""); + + + writeFile(resFile,res); + + + } + + public void create051() throws Exception + { + String TestNumber = "051"; + String reqFile = fileprefix + TestNumber + ".Req"+filesuffix; + + String req = replaceString(defaultblock,"",b64_der_data_exp); + req = replaceStringAll(req,"anyURI",configuration_.getProperty("webbaseDir") + "resources/testDaten.txt"); + req = replaceString(req, + "Signatories=\"1\"", + "Signatories=\"0\""); + + + writeFile(reqFile,req); + + String resFile = fileprefix + TestNumber + ".ErrRes"+filesuffix; + + writeFile(resFile,"1100"); + } + + public void create052() throws Exception + { + String TestNumber = "052"; + String reqFile = fileprefix + TestNumber + ".Req"+filesuffix; + + String req = replaceString(defaultblock,"",b64_der_data_exp); + req = replaceStringAll(req,"anyURI",configuration_.getProperty("webbaseDir") + "resources/testDaten.txt"); + req = replaceString(req, + "Signatories=\"1\"", + "Signatories=\"10\""); + + + writeFile(reqFile,req); + + String resFile = fileprefix + TestNumber + ".ErrRes"+filesuffix; + + writeFile(resFile,"2249"); + } + + public void create053() throws Exception + { + String TestNumber = "053"; + String reqFile = fileprefix + TestNumber + ".Req"+filesuffix; + + String req = replaceString(defaultblock,"",b64_der_data_exp); + req = replaceStringAll(req,"anyURI",configuration_.getProperty("webbaseDir") + "resources/testDaten.txt"); + req = replaceString(req, + "2003-04-04T09:30:47-05:00", + ""+getDate(1*34*24)+""); + + writeFile(reqFile,req); + + String resFile = fileprefix + TestNumber + ".ErrRes"+filesuffix; + + writeFile(resFile,"0000"); + } + + public void create054() throws Exception + { + String TestNumber = "054"; + String reqFile = fileprefix + TestNumber + ".Req"+filesuffix; + + String req = replaceString(defaultblock, + "", + "this is no Base64 Data"); + req = replaceStringAll(req,"anyURI",configuration_.getProperty("webbaseDir") + "resources/testDaten.txt"); + + writeFile(reqFile,req); + + String resFile = fileprefix + TestNumber + ".ErrRes"+filesuffix; + + writeFile(resFile,"1100"); + + } + + public void create055() throws Exception + { + String TestNumber = "055"; + String reqFile = fileprefix + TestNumber + ".Req"+filesuffix; + + String req = replaceString(defaultblock,"",b64_der_data_exp); + req = replaceStringAll(req,"anyURI",configuration_.getProperty("webbaseDir") + "resources/testDaten.txt"); + req = replaceString(req, + ""+ + ""+ + "text/plain"+ + ""+configuration_.getProperty("webbaseDir") + "resources/testDaten.txt"+ + ""+ + ""+ + "RGllcyBzaW5kIFRlc3RkYXRlbg0KMi4gWmVpbGUNCjMuIFplaWxlDQphdXM="+ + ""+ + "", + ""); + + writeFile(reqFile,req); + + String resFile = fileprefix + TestNumber + ".ErrRes"+filesuffix; + + writeFile(resFile,"2248"); + + } + + + + public void create010() throws Exception + { + String TestNumber = "010"; + String reqFile = fileprefix + TestNumber + ".Req"+filesuffix; + + String req = replaceString(defaultblock,"",b64_der_data_exp); + req = replaceString(req,"",""); + req = replaceStringAll(req,"anyURI",configuration_.getProperty("webbaseDir") + "resources/testDaten.txt"); + req = replaceString(req, + "RGllcyBzaW5kIFRlc3RkYXRlbg0KMi4gWmVpbGUNCjMuIFplaWxlDQphdXM=", + ""); + writeFile(reqFile,req); + + String resFile = fileprefix + TestNumber + ".Res"+filesuffix; + + String res = replaceString(defaultresponse,"",this.X509name); + res = replaceString(res,"",this.X509number.toString()); + res = replaceString(res,"",this.X509sub); + res = replaceString(res,"","0"); + res = replaceString(res,"","0"); + res = replaceString(res,"",cert_file_data); + res = replaceString(res,"",""); + + writeFile(resFile,res); + + } + + public void create056() throws Exception + { + String TestNumber = "056"; + String reqFile = fileprefix + TestNumber + ".Req"+filesuffix; + + String req = replaceString(defaultblock,"",b64_der_data_exp); + req = replaceStringAll(req,"anyURI",configuration_.getProperty("webbaseDir") + "resources/testDaten.txt"); + req = replaceString(req, + "TrustProfile1", + "notvalidTrustProfileID"); + + writeFile(reqFile,req); + + String resFile = fileprefix + TestNumber + ".ErrRes"+filesuffix; + + writeFile(resFile,"2203"); + + } + + + public void create057() throws Exception + { + String TestNumber = "057"; + String reqFile = fileprefix + TestNumber + ".Req"+filesuffix; + + + configuration_.setProperty( + "PKCS12file_maxmustermann", + (configuration_.getProperty("baseDir") + "/resources/Max_Mustermann (max).p12")); + + configuration_.setProperty("PKCS12password_maxmustermann", "max"); + + configuration_.setProperty( + "CERT_maxmustermann", + (configuration_.getProperty("baseDir") + "resources/Max_Mustermann.cer")); + + BufferedInputStream bis = new BufferedInputStream(new FileInputStream(configuration_.getProperty("CERT_maxmustermann"))); + iaik.x509.X509Certificate cert = new iaik.x509.X509Certificate(bis); + X509name = ((Name)(cert.getIssuerDN())).getRFC2253String(); + X509number = cert.getSerialNumber(); + X509hash = new String(cert.getFingerprintSHA()); + X509sub = ((Name)(cert.getSubjectDN())).getRFC2253String(); + + String m = "This is a message"; + System.out.println("*"+m+"*"); + byte[] message = m.getBytes(); + + ASN1Object obj = null; + obj = createSignedCMSData(message, SignedDataStream.IMPLICIT,false,"PKCS12file_maxmustermann","PKCS12password_maxmustermann","CERT_maxmustermann"); + byte[] sig = DerCoder.encode(obj); + writeFileBinary("testimplmax.ber",sig); + b64_der_data_max = (new BASE64Encoder()).encode(sig); + + + String req = replaceString(defaultblock,"",b64_der_data_max); + + /*req = replaceString(req, + " "+ + " "+ + " text/plain"+ + " anyURI"+ + " "+ + " "+ + " RGllcyBzaW5kIFRlc3RkYXRlbg0KMi4gWmVpbGUNCjMuIFplaWxlDQphdXM="+ + " "+ + " ", + "");*/ + + //req = replaceString(req,"Reference=\"anyURI\"",""); + + req = replaceStringAll(req,"anyURI",configuration_.getProperty("webbaseDir") + "resources/testDaten.txt"); + + + + writeFile(reqFile,req); + + String resFile = fileprefix + TestNumber + ".ErrRes"+filesuffix; + + writeFile(resFile,"2248"); + + + } + + public void create058() throws Exception + { + String TestNumber = "058"; + String reqFile = fileprefix + TestNumber + ".Req"+filesuffix; + + String req = replaceString(defaultblock,"",b64_der_data_exp); + req = replaceStringAll(req,"anyURI",configuration_.getProperty("webbaseDir") + "resources/testDaten.txt"); + + req = replaceString(req,"RGllcyBzaW5kIFRlc3RkYXRlbg0KMi4gWmVpbGUNCjMuIFplaWxlDQphdXM=","RGllcyBzaW5kIFRlc3RkYXRlbg0KMi4gWmVpbGUNCjMuIFplaWxlDQphdXM=()"); + writeFile(reqFile,req); + + String resFile = fileprefix + TestNumber + ".ErrRes"+filesuffix; + + writeFile(resFile,"1100"); + + } + + + + + + + +} -- cgit v1.2.3