summaryrefslogtreecommitdiff
path: root/src/test/java/at/gv/util
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/java/at/gv/util')
-rw-r--r--src/test/java/at/gv/util/demo/Clienttests.java250
1 files changed, 189 insertions, 61 deletions
diff --git a/src/test/java/at/gv/util/demo/Clienttests.java b/src/test/java/at/gv/util/demo/Clienttests.java
index e984263..7cf0fe0 100644
--- a/src/test/java/at/gv/util/demo/Clienttests.java
+++ b/src/test/java/at/gv/util/demo/Clienttests.java
@@ -5,33 +5,43 @@ import iaik.security.ecc.interfaces.ECDSAPublicKey;
import iaik.security.ecc.math.ecgroup.AffineCoordinate;
import iaik.security.ecc.math.ecgroup.ECPoint;
import iaik.security.ecc.provider.ECCProvider;
+import iaik.x509.X509Certificate;
import java.io.File;
import java.io.FileInputStream;
+import java.io.FileOutputStream;
import java.io.IOException;
+import java.io.InputStream;
import java.math.BigInteger;
import java.security.InvalidKeyException;
import java.security.PublicKey;
+import java.security.cert.CertificateException;
import java.security.interfaces.DSAParams;
import java.security.interfaces.DSAPublicKey;
import java.security.interfaces.ECPublicKey;
import java.security.interfaces.RSAPublicKey;
import java.text.SimpleDateFormat;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Properties;
+import java.util.TimeZone;
import javax.xml.bind.JAXBElement;
import javax.xml.namespace.QName;
import javax.xml.transform.TransformerException;
import org.apache.cxf.common.util.Base64Utility;
+import org.apache.cxf.helpers.IOUtils;
import org.w3c.dom.Element;
import at.gv.util.BpkUtil;
import at.gv.util.DOMUtils;
+import at.gv.util.MiscUtil;
import at.gv.util.client.szr.SZRClient;
import at.gv.util.client.ur_V5.URClient;
import at.gv.util.client.ur_V5.URClient.URSearchResult;
@@ -49,12 +59,15 @@ import at.gv.util.xsd.szr.ecdsa.ECDSAKeyValueType;
import at.gv.util.xsd.szr.ecdsa.ECPointType;
import at.gv.util.xsd.szr.ecdsa.NamedCurveType;
import at.gv.util.xsd.szr.ecdsa.PrimeFieldElemType;
+import at.gv.util.xsd.szr.persondata.DeliveryAddressType;
import at.gv.util.xsd.szr.persondata.IdentificationType;
import at.gv.util.xsd.szr.persondata.PersonNameType;
import at.gv.util.xsd.szr.persondata.PhysicalPersonType;
+import at.gv.util.xsd.szr.persondata.PostalAddressType;
import at.gv.util.xsd.szr.xmldsig.DSAKeyValueType;
import at.gv.util.xsd.szr.xmldsig.KeyValueType;
import at.gv.util.xsd.szr.xmldsig.RSAKeyValueType;
+import at.gv.util.xsd.ur_V5.pd.NichtNatuerlichePersonTyp;
public class Clienttests {
@@ -108,7 +121,7 @@ public class Clienttests {
try {
SZRClient szrClient = new SZRClient(egovUtilConfiguration);
- URClient urClient = new URClient(egovUtilConfiguration, UR_TYPES, ERSB_KEYS, false, false);
+ URClient urClient = new URClient(egovUtilConfiguration, UR_TYPES, ERSB_KEYS, false, true);
PersonInfoType personInfo = new PersonInfoType();
@@ -118,28 +131,126 @@ public class Clienttests {
person.setName(personName );
IdentificationType id = new IdentificationType();
+ PostalAddressType address = new PostalAddressType();
+
// id.setType(SSPIN_PREFIX + "ZP");
// id.setValue("U/wThc0XOTZp9Tvsxrh8DhGTXsU=");
// person.setIdentification(id);
- personName.setFamilyName("Karning");
- personName.setGivenName("Bernhard");
- person.setDateOfBirth("1976-01-15");
+ personName.setFamilyName("Lenz");
+ personName.setGivenName("Thomas");
+ person.setDateOfBirth("1982-09-06");
+
+ personName.setFamilyName("ALLMBlasznig ELGATest");
+ personName.setGivenName("Reinfried");
+ person.setDateOfBirth("1943-06-26");
+ personName.setFamilyName("Buxbaum");
+ personName.setGivenName("Georg");
+ person.setDateOfBirth("1964-10-09");
+
+ personName.setFamilyName("Eder");
+ personName.setGivenName("Michaela");
+ person.setDateOfBirth("1971-04-25");
+// id.setType(SSPIN_PREFIX + "ZP");
+// id.setValue("T2wnifoq7CJDyhhWod7+YiZilLA=");
+// person.setIdentification(id);
+// personName.setFamilyName("Buxbaum");
+// personName.setGivenName("Doris");
+// person.setDateOfBirth("1976-05-26");
- String baseID = szrClient.getStammzahl(personInfo );
+// personName.setFamilyName("Lackner");
+// personName.setGivenName("Christiane");
+// person.setDateOfBirth("1965-04-22");
+
+// personName.setFamilyName("Karning");
+// personName.setGivenName("Bernhard");
+// person.setDateOfBirth("1976-01-15");
+
+// personName.setFamilyName("Müller");
+// personName.setGivenName("Harald");
+// person.setDateOfBirth("1964-10-30");
+// personInfo.setRegularDomicile(address );
+// address.setPostalCode("1130");
+// personName.setFamilyName("Rudinger");
+// personName.setGivenName("Franz");
+// person.setDateOfBirth("1973-04-18");
+
+// personName.setFamilyName("Pointner");
+// personName.setGivenName("Johann");
+//// person.setDateOfBirth("1954-07-07");
+// personInfo.setRegularDomicile(address);
+// DeliveryAddressType delivAddr = new DeliveryAddressType();
+//// address.setMunicipality("Linz");
+// //address.setLocality("Wels");
+// address.setPostalCode("4030");
+
+
+ //String bpks = szrClient.getBPK(personInfo, SSPIN_PREFIX + "ZP", "BBA-STA");
+// String bpks = szrClient.getBPK(personInfo, SSPIN_PREFIX + "ZU", "BBA-STA");
+//
+//
+
+ //InputStream is = Clienttests.class.getResourceAsStream("/clearing_geburtstage_mit_UTC_versatz_20180214.csv");
+ InputStream is = Clienttests.class.getResourceAsStream("/clearing_geburtstage_mit_UTC_versatz_20180305.csv");
+ String data = IOUtils.toString(is);
+ for (String line : data.split("\\n")) {
+ try {
+ String[] el = line.split(",");
+
+ personName.setFamilyName(el[4]);
+ personName.setGivenName(el[3]);
+
+ String date = el[5].substring(1, el[5].length()-1);
+ Date test = MiscUtil.parseDate(date, "yyyy-MM-dd", TimeZone.getTimeZone("UTC"));
+ Date tomorrow = new Date(test.getTime() + (1000 * 60 * 60 * 24));
+ person.setDateOfBirth(MiscUtil.formatDate(tomorrow, "yyyy-MM-dd"));
+
+
+ String baseID = szrClient.getStammzahl(personInfo );
+ System.out.println("OK!!! " + person.getName().getGivenName() + " " + person.getName().getFamilyName());
+
+
+ } catch ( Exception e) {
+ e.printStackTrace();
+ }
+
+
+ }
+
+
+
+
+ personName.setFamilyName("Hembach");
+ personName.setGivenName("Alfred");
+ person.setDateOfBirth("1975-03-02");
+
+ personName.setFamilyName("Atzlinger");
+ personName.setGivenName("Manfred");
+ person.setDateOfBirth("1964-01-29");
+
+ personName.setFamilyName("Doppler");
+ personName.setGivenName("Dominik");
+ person.setDateOfBirth("1998-04-14");
+
+ String baseID = szrClient.getStammzahl(personInfo );
+//
BPK zpBpk = BpkUtil.createBPK(baseID, "ZP");
+//
+// personInfo.getPerson().setDateOfBirth(null);
- String encryptedbPK = szrClient.transformBPK(personInfo, zpBpk.getBpk(), SSPIN_PREFIX + "ZP", SSPIN_PREFIX + "WT-UR", "BBA-STA");
+// String test = szrClient.getBPK(personInfo, "BF", "BBA-STA");
+
+// String encryptedbPK = szrClient.transformBPK(personInfo, zpBpk.getBpk(), SSPIN_PREFIX + "ZP", SSPIN_PREFIX + "WT-UR", "BBA-STA");
// GetIdentityLink idlReq = createGetIdentityLink();
-//
-// String baseIDResp = szrClient.getStammzahl(personInfo);
-//
+////
+////// String baseIDResp = szrClient.getStammzahl(personInfo);
+//////
// IdentityLinkType idlResp = szrClient.getIdentityLink(
// idlReq.getPersonInfo(),
// idlReq.getKeyValue(),
@@ -147,71 +258,89 @@ public class Clienttests {
// Element idl = (Element)idlResp.getAssertion();
// System.out.println(DOMUtils.serializeNode(idl));
+// FileOutputStream writeToFile = new FileOutputStream("D:/local_work/zertifikate/ELGA_mocca_testcards/Allwsoker_Elgatest.idl");
+// writeToFile.write(DOMUtils.serializeNode(idl).getBytes());
+// writeToFile.close();
- List<URSearchResult> urResult = urClient.searchByBpk(encryptedbPK);
-
- System.out.println("Finish");
-
-
+
+// List<NichtNatuerlichePersonTyp> urResult = urClient.searchByRegisterNumber("9110008265019", "ERJ", 10);
- } catch (EgovUtilException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+// urResult = urClient.searchByName("Bundesministerium*", null, 10);
- } catch (SZRException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+// List<URSearchResult> urResult = urClient.searchByBpk(encryptedbPK);
+// List<URSearchResult> urResult = urClient.searchByRegisterNumberFullInfo("237384w", "FBN", 10);
- } catch (URClientException e) {
- // TODO Auto-generated catch block
+ System.out.println("Finish");
+
+ } catch (Exception e) {
e.printStackTrace();
}
}
- private static GetIdentityLink createGetIdentityLink(){
+ private static GetIdentityLink createGetIdentityLink() throws CertificateException, IOException{
// set parameter
GetIdentityLink getIdentityLink = new GetIdentityLink();
+
+ SimpleDateFormat formater = new SimpleDateFormat("yyyy-MM-dd");
+ PersonInfoType personInfo = new PersonInfoType();
+ PhysicalPersonType physicalPerson = new PhysicalPersonType();
+ PostalAddressType address = new PostalAddressType();
// generate PersonData
PersonNameType personName = new PersonNameType();
- personName.setFamilyName("Janez Vzorec");
- personName.setGivenName("Janez Vzorec");
-
- PhysicalPersonType physicalPerson = new PhysicalPersonType();
- SimpleDateFormat formater = new SimpleDateFormat("yyyy-MM-dd");
-
- String birthday = "1998-12-06";
+// personName.setFamilyName("Janez Vzorec");
+// personName.setGivenName("Janez Vzorec");
+
+// personName.setFamilyName("ALLWSoker ELGATest");
+// personName.setGivenName("Zilli Winnimar");
+
+// personName.setFamilyName("Pointner");
+// personName.setGivenName("Johann");
+// address.setMunicipality("Linz");
+// address.setPostalCode("4030");
+// String birthday = "1954-07-07";
+// String birthday = "1928-04-10";
+
+ personName.setFamilyName("Kern");
+ personName.setGivenName("Thomas");
+ String birthday = null;
+ address.setMunicipality("Obdach");
+ address.setPostalCode("8742");
+
+
+
+
+ //String birthday = "1998-12-06";
if (birthday != null)
physicalPerson.setDateOfBirth(birthday);
physicalPerson.setName(personName);
-
- PersonInfoType personInfo = new PersonInfoType();
+ if (address != null)
+ personInfo.setRegularDomicile(address);
personInfo.setPerson(physicalPerson);
-
-
+
// add Traveldocument
- TravelDocumentType trvlDoc = new TravelDocumentType();
-
- // parse STORK-eID to his components
- //ERnB allows only eIDs with a maximum length of 54 signs
- trvlDoc.setDocumentNumber("33333333");
- trvlDoc.setIssuingCountry("SI");
- trvlDoc.setDocumentType(DOCUMENT_TYPE);
-
- //set default values from SZR because certificate for mandator natural person is not
- //available in case of authentication with electronic mandates.
- trvlDoc.setIssueDate(ERnB_ISSUEDATE);
- trvlDoc.setIssuingAuthority(ERnB_ISSUINGAUTHORITY);
-
- JAXBElement<TravelDocumentType> jaxbtrvlDoc = personInfo.getTravelDocument();
-
- if (jaxbtrvlDoc == null)
- jaxbtrvlDoc = new JAXBElement<TravelDocumentType>(new QName("urn:SZRServices", "TravelDocument"), TravelDocumentType.class, trvlDoc);
- else
- jaxbtrvlDoc.setValue(trvlDoc);
+// TravelDocumentType trvlDoc = new TravelDocumentType();
+//
+// // parse STORK-eID to his components
+// //ERnB allows only eIDs with a maximum length of 54 signs
+// trvlDoc.setDocumentNumber("33333333");
+// trvlDoc.setIssuingCountry("SI");
+// trvlDoc.setDocumentType(DOCUMENT_TYPE);
+//
+// //set default values from SZR because certificate for mandator natural person is not
+// //available in case of authentication with electronic mandates.
+// trvlDoc.setIssueDate(ERnB_ISSUEDATE);
+// trvlDoc.setIssuingAuthority(ERnB_ISSUINGAUTHORITY);
+//
+// JAXBElement<TravelDocumentType> jaxbtrvlDoc = personInfo.getTravelDocument();
+//
+// if (jaxbtrvlDoc == null)
+// jaxbtrvlDoc = new JAXBElement<TravelDocumentType>(new QName("urn:SZRServices", "TravelDocument"), TravelDocumentType.class, trvlDoc);
+// else
+// jaxbtrvlDoc.setValue(trvlDoc);
//personInfo.setTravelDocument(jaxbtrvlDoc);
@@ -226,15 +355,14 @@ public class Clienttests {
keyvalueList = new ArrayList<KeyValueType>();
- try {
- pb = new iaik.security.rsa.RSAPublicKey(DEFAULT_PUBL_KEY);
- List<KeyValueType> keys = getKeyValueTypes(pb);
- keyvalueList.addAll(keys);
-
- } catch (InvalidKeyException e) {
- e.printStackTrace();
+ InputStream importCertStream = new FileInputStream("F:/local_work/zertifikate/mocca_testcards/BRZ_testcards/test_identities/Achim XXXZastrow/secure.crt");
+ X509Certificate importCert = new X509Certificate(importCertStream );
+ pb = importCert.getPublicKey();
+
+ //pb = new iaik.security.rsa.RSAPublicKey(DEFAULT_PUBL_KEY);
+ List<KeyValueType> keys = getKeyValueTypes(pb);
+ keyvalueList.addAll(keys);
- }
// set Insert ERnP flag
getIdentityLink.setInsertERnP(false);