diff options
author | tzefferer <tzefferer@gmail.com> | 2018-07-27 13:14:35 +0200 |
---|---|---|
committer | tzefferer <tzefferer@gmail.com> | 2018-07-27 13:14:35 +0200 |
commit | 84f5ffce2e66e52a07ef6bdcb802e268566168e0 (patch) | |
tree | 2c996d4d61511886804c83a9133b9d75ed635e48 /eidas_modules/authmodule-eIDAS-v2/src/test/java | |
parent | a3e019e87d78e17f24c170f7ef6a08d40ebfb232 (diff) | |
parent | 6d09f43225ba2e0f6d7b0583f843c858a1015807 (diff) | |
download | National_eIDAS_Gateway-84f5ffce2e66e52a07ef6bdcb802e268566168e0.tar.gz National_eIDAS_Gateway-84f5ffce2e66e52a07ef6bdcb802e268566168e0.tar.bz2 National_eIDAS_Gateway-84f5ffce2e66e52a07ef6bdcb802e268566168e0.zip |
Merge branch 'master' of gitlab.iaik.tugraz.at:egiz/eidas_at_proxy
# Conflicts:
# eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/test/eidas/specific/modules/authmodule_eIDASv2/SZRClientTest.java
Diffstat (limited to 'eidas_modules/authmodule-eIDAS-v2/src/test/java')
2 files changed, 347 insertions, 172 deletions
diff --git a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/test/eidas/specific/modules/authmodule_eIDASv2/SZRClientTest.java b/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/test/eidas/specific/modules/authmodule_eIDASv2/SZRClientTest.java new file mode 100644 index 00000000..e68dcb9b --- /dev/null +++ b/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/test/eidas/specific/modules/authmodule_eIDASv2/SZRClientTest.java @@ -0,0 +1,347 @@ +<<<<<<< HEAD:eidas_modules/authmodule-eIDAS-v2/src/test/java/at/gv/egiz/test/eidas/specific/modules/authmodule_eIDASv2/SZRClientTest.java +//package at.gv.egiz.test.eidas.specific.modules.authmodule_eIDASv2; +// +//import java.io.IOException; +//import java.math.BigInteger; +//import java.security.InvalidKeyException; +//import java.security.NoSuchProviderException; +//import java.security.PublicKey; +//import java.security.interfaces.RSAPublicKey; +//import java.util.ArrayList; +//import java.util.List; +// +//import org.apache.commons.lang3.StringUtils; +//import org.junit.Test; +//import org.junit.runner.RunWith; +//import org.slf4j.Logger; +//import org.slf4j.LoggerFactory; +//import org.springframework.beans.factory.annotation.Autowired; +//import org.springframework.test.context.ContextConfiguration; +//import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +//import org.springframework.util.Base64Utils; +//import org.w3._2000._09.xmldsig.KeyValueType; +//import org.w3._2000._09.xmldsig.RSAKeyValueType; +//import org.w3c.dom.Element; +// +//import at.gv.e_government.reference.namespace.persondata._20020228.PersonNameType; +//import at.gv.e_government.reference.namespace.persondata._20020228.PhysicalPersonType; +//import at.gv.egiz.eaaf.core.api.data.EAAFConstants; +//import at.gv.egiz.eaaf.core.api.idp.IConfiguration; +//import at.gv.egiz.eaaf.core.api.idp.auth.data.IIdentityLink; +//import at.gv.egiz.eaaf.core.exceptions.EAAFParserException; +//import at.gv.egiz.eaaf.core.impl.data.Trible; +//import at.gv.egiz.eaaf.core.impl.idp.auth.data.SimpleIdentityLinkAssertionParser; +//import at.gv.egiz.eidas.specific.modules.authmodule_eIDASv2.Constants; +//import at.gv.egiz.eidas.specific.modules.authmodule_eIDASv2.exception.SZRCommunicationException; +//import at.gv.egiz.eidas.specific.modules.authmodule_eIDASv2.szr.SZRClient; +//import at.gv.egiz.eidas.specific.modules.authmodule_eIDASv2.utils.eIDASResponseUtils; +//import szrservices.IdentityLinkType; +//import szrservices.PersonInfoType; +//import szrservices.SZRException_Exception; +//import szrservices.TravelDocumentType; +// +//@RunWith(SpringJUnit4ClassRunner.class) +//@ContextConfiguration("/SpringTest-context_basic_test.xml") +//public class SZRClientTest { +// private static final Logger log = LoggerFactory.getLogger(SZRClientTest.class); +// +// @Autowired SZRClient szrClient; +// @Autowired IConfiguration basicConfig; +// +// private static final String givenName = "Franz"; +// private static final String familyName = "Mustermann"; +// private static final String dateOfBirth = "1987-05-05"; +// private static final String eIDASeID = "IS/AT/123456789ABCDE"; +// +// private static final String DUMMY_TARGET = EAAFConstants.URN_PREFIX_CDID + "ZP"; +// +// @Test +// public void dummyTest() { +// +// } +// +// +// //@Test +// public void getIdentityLink() throws SZRException_Exception, EAAFParserException, NoSuchProviderException, IOException, InvalidKeyException, SZRCommunicationException { +// log.debug("Starting connecting SZR Gateway"); +// IdentityLinkType result = szrClient.getIdentityLink( +// getPersonInfo(), +// dummyCodeForKeys(), +// basicConfig.getBasicMOAIDConfigurationBoolean( +// Constants.CONIG_PROPS_EIDAS_SZRCLIENT_DEBUG_INSERTERNB, +// true) +// ); +// +// Element idlFromSZR = (Element)result.getAssertion(); +// IIdentityLink identityLink = new SimpleIdentityLinkAssertionParser(idlFromSZR).parseIdentityLink(); +// if (identityLink == null) +// throw new SZRCommunicationException("ernb.00", new Object[] {"bPK is null or empty"}); +// +// } +// +// //@Test +// public void getbPKTest() throws SZRException_Exception, SZRCommunicationException { +// String bPK = szrClient.getBPK(getPersonInfo(), DUMMY_TARGET, +// basicConfig.getBasicConfiguration( +// Constants.CONIG_PROPS_EIDAS_SZRCLIENT_PARAMS_VKZ, +// "no VKZ defined")); +// +// if (StringUtils.isEmpty(bPK)) +// throw new SZRCommunicationException("ernb.01", new Object[] {"bPK is null or empty"}); +// +// +// } +// +// private PersonInfoType getPersonInfo() { +// PersonInfoType personInfo = new PersonInfoType(); +// PersonNameType personName = new PersonNameType(); +// PhysicalPersonType naturalPerson = new PhysicalPersonType(); +// TravelDocumentType eDocument = new TravelDocumentType(); +// +// naturalPerson.setName(personName ); +// personInfo.setPerson(naturalPerson ); +// personInfo.setTravelDocument(eDocument ); +// +// //parse some eID attributes +// Trible<String, String, String> eIdentifier = +// eIDASResponseUtils.parseEidasPersonalIdentifier((String)eIDASeID); +// String uniqueId = (String)eIDASeID; +// String citizenCountry = eIdentifier.getFirst(); +// +// //person information +// personName.setFamilyName((String)familyName); +// personName.setGivenName((String)givenName); +// naturalPerson.setDateOfBirth(dateOfBirth); +// eDocument.setIssuingCountry(citizenCountry); +// eDocument.setDocumentNumber(uniqueId); +// +// //eID document information +// eDocument.setDocumentType(basicConfig.getBasicConfiguration( +// Constants.CONIG_PROPS_EIDAS_SZRCLIENT_PARAMS_EDOCUMENTTYPE, +// Constants.SZR_CONSTANTS_DEFAULT_DOCUMENT_TYPE)); +// +// //TODO: that should be removed +// eDocument.setIssueDate(basicConfig.getBasicConfiguration( +// Constants.CONIG_PROPS_EIDAS_SZRCLIENT_PARAMS_ISSUING_DATE, +// Constants.SZR_CONSTANTS_DEFAULT_ISSUING_DATE)); +// eDocument.setIssuingAuthority(basicConfig.getBasicConfiguration( +// Constants.CONIG_PROPS_EIDAS_SZRCLIENT_PARAMS_ISSUING_AUTHORITY, +// Constants.SZR_CONSTANTS_DEFAULT_ISSUING_AUTHORITY)); +// +// return personInfo; +// } +// +// +// private List<KeyValueType> dummyCodeForKeys() throws IOException, NoSuchProviderException, InvalidKeyException { +// if (basicConfig.getBasicMOAIDConfigurationBoolean( +// Constants.CONIG_PROPS_EIDAS_SZRCLIENT_PARAMS_KEYS_USEDUMMY, +// false)) { +// List<KeyValueType> keyvalueList = new ArrayList<KeyValueType>(); +// try { +// //Security.addProvider(new BouncyCastleProvider()); +// //PKCS8EncodedKeySpec spec = new PKCS8EncodedKeySpec(Constants.SZR_CONSTANTS_DEFAULT_PUBL_KEY); +// //KeyFactory kf = KeyFactory.getInstance("RSA", "BC"); +// +// //PublicKey pb = kf.generatePublic(spec); +// PublicKey pb = new iaik.security.rsa.RSAPublicKey(Constants.SZR_CONSTANTS_DEFAULT_PUBL_KEY); +// +// RSAPublicKey rsapb = (RSAPublicKey)pb; +// BigInteger modulus = rsapb.getModulus(); +// BigInteger exponent = rsapb.getPublicExponent(); +// +// // set key values +// RSAKeyValueType rsa = new RSAKeyValueType(); +// rsa.setExponent(new String(Base64Utils.encode(exponent.toByteArray()))); +// rsa.setModulus(new String(Base64Utils.encode(modulus.toByteArray()))); +// +// KeyValueType key = new KeyValueType(); +// key.setRSAKeyValue(rsa); +// +// keyvalueList.add(key); +// +// return keyvalueList; +// } catch (Exception e) { +// log.error("TestCode has an internal ERROR", e); +// throw e; +// } +// +// } +// +// return null; +// +// } +//} +======= +package at.asitplus.test.eidas.specific.modules.authmodule_eIDASv2; + +import java.io.IOException; +import java.math.BigInteger; +import java.security.InvalidKeyException; +import java.security.NoSuchProviderException; +import java.security.PublicKey; +import java.security.interfaces.RSAPublicKey; +import java.util.ArrayList; +import java.util.List; + +import org.apache.commons.lang3.StringUtils; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.util.Base64Utils; +import org.w3._2000._09.xmldsig.KeyValueType; +import org.w3._2000._09.xmldsig.RSAKeyValueType; +import org.w3c.dom.Element; + +import at.asitplus.eidas.specific.modules.authmodule_eIDASv2.Constants; +import at.asitplus.eidas.specific.modules.authmodule_eIDASv2.exception.SZRCommunicationException; +import at.asitplus.eidas.specific.modules.authmodule_eIDASv2.szr.SZRClient; +import at.asitplus.eidas.specific.modules.authmodule_eIDASv2.utils.eIDASResponseUtils; +import at.gv.e_government.reference.namespace.persondata._20020228.PersonNameType; +import at.gv.e_government.reference.namespace.persondata._20020228.PhysicalPersonType; +import at.gv.egiz.eaaf.core.api.data.EAAFConstants; +import at.gv.egiz.eaaf.core.api.idp.IConfiguration; +import at.gv.egiz.eaaf.core.api.idp.auth.data.IIdentityLink; +import at.gv.egiz.eaaf.core.exceptions.EAAFParserException; +import at.gv.egiz.eaaf.core.impl.data.Trible; +import at.gv.egiz.eaaf.core.impl.idp.auth.data.SimpleIdentityLinkAssertionParser; +import szrservices.IdentityLinkType; +import szrservices.PersonInfoType; +import szrservices.SZRException_Exception; +import szrservices.TravelDocumentType; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration("/SpringTest-context_basic_test.xml") +public class SZRClientTest { + private static final Logger log = LoggerFactory.getLogger(SZRClientTest.class); + + @Autowired SZRClient szrClient; + @Autowired IConfiguration basicConfig; + + private static final String givenName = "Franz"; + private static final String familyName = "Mustermann"; + private static final String dateOfBirth = "1987-05-05"; + private static final String eIDASeID = "IS/AT/123456789ABCDE"; + + private static final String DUMMY_TARGET = EAAFConstants.URN_PREFIX_CDID + "ZP"; + + @Test + public void dummyTest() { + + } + + + //@Test + public void getIdentityLink() throws SZRException_Exception, EAAFParserException, NoSuchProviderException, IOException, InvalidKeyException, SZRCommunicationException { + log.debug("Starting connecting SZR Gateway"); + IdentityLinkType result = szrClient.getIdentityLink( + getPersonInfo(), + dummyCodeForKeys(), + basicConfig.getBasicMOAIDConfigurationBoolean( + Constants.CONIG_PROPS_EIDAS_SZRCLIENT_DEBUG_INSERTERNB, + true) + ); + + Element idlFromSZR = (Element)result.getAssertion(); + IIdentityLink identityLink = new SimpleIdentityLinkAssertionParser(idlFromSZR).parseIdentityLink(); + if (identityLink == null) + throw new SZRCommunicationException("ernb.00", new Object[] {"bPK is null or empty"}); + + } + + //@Test + public void getbPKTest() throws SZRException_Exception, SZRCommunicationException { + String bPK = szrClient.getBPK(getPersonInfo(), DUMMY_TARGET, + basicConfig.getBasicConfiguration( + Constants.CONIG_PROPS_EIDAS_SZRCLIENT_PARAMS_VKZ, + "no VKZ defined")); + + if (StringUtils.isEmpty(bPK)) + throw new SZRCommunicationException("ernb.01", new Object[] {"bPK is null or empty"}); + + + } + + private PersonInfoType getPersonInfo() { + PersonInfoType personInfo = new PersonInfoType(); + PersonNameType personName = new PersonNameType(); + PhysicalPersonType naturalPerson = new PhysicalPersonType(); + TravelDocumentType eDocument = new TravelDocumentType(); + + naturalPerson.setName(personName ); + personInfo.setPerson(naturalPerson ); + personInfo.setTravelDocument(eDocument ); + + //parse some eID attributes + Trible<String, String, String> eIdentifier = + eIDASResponseUtils.parseEidasPersonalIdentifier((String)eIDASeID); + String uniqueId = (String)eIDASeID; + String citizenCountry = eIdentifier.getFirst(); + + //person information + personName.setFamilyName((String)familyName); + personName.setGivenName((String)givenName); + naturalPerson.setDateOfBirth(dateOfBirth); + eDocument.setIssuingCountry(citizenCountry); + eDocument.setDocumentNumber(uniqueId); + + //eID document information + eDocument.setDocumentType(basicConfig.getBasicConfiguration( + Constants.CONIG_PROPS_EIDAS_SZRCLIENT_PARAMS_EDOCUMENTTYPE, + Constants.SZR_CONSTANTS_DEFAULT_DOCUMENT_TYPE)); + + //TODO: that should be removed + eDocument.setIssueDate(basicConfig.getBasicConfiguration( + Constants.CONIG_PROPS_EIDAS_SZRCLIENT_PARAMS_ISSUING_DATE, + Constants.SZR_CONSTANTS_DEFAULT_ISSUING_DATE)); + eDocument.setIssuingAuthority(basicConfig.getBasicConfiguration( + Constants.CONIG_PROPS_EIDAS_SZRCLIENT_PARAMS_ISSUING_AUTHORITY, + Constants.SZR_CONSTANTS_DEFAULT_ISSUING_AUTHORITY)); + + return personInfo; + } + + + private List<KeyValueType> dummyCodeForKeys() throws IOException, NoSuchProviderException, InvalidKeyException { + if (basicConfig.getBasicMOAIDConfigurationBoolean( + Constants.CONIG_PROPS_EIDAS_SZRCLIENT_PARAMS_KEYS_USEDUMMY, + false)) { + List<KeyValueType> keyvalueList = new ArrayList<KeyValueType>(); + try { + //Security.addProvider(new BouncyCastleProvider()); + //PKCS8EncodedKeySpec spec = new PKCS8EncodedKeySpec(Constants.SZR_CONSTANTS_DEFAULT_PUBL_KEY); + //KeyFactory kf = KeyFactory.getInstance("RSA", "BC"); + + //PublicKey pb = kf.generatePublic(spec); + PublicKey pb = new iaik.security.rsa.RSAPublicKey(Constants.SZR_CONSTANTS_DEFAULT_PUBL_KEY); + + RSAPublicKey rsapb = (RSAPublicKey)pb; + BigInteger modulus = rsapb.getModulus(); + BigInteger exponent = rsapb.getPublicExponent(); + + // set key values + RSAKeyValueType rsa = new RSAKeyValueType(); + rsa.setExponent(new String(Base64Utils.encode(exponent.toByteArray()))); + rsa.setModulus(new String(Base64Utils.encode(modulus.toByteArray()))); + + KeyValueType key = new KeyValueType(); + key.setRSAKeyValue(rsa); + + keyvalueList.add(key); + + return keyvalueList; + } catch (Exception e) { + log.error("TestCode has an internal ERROR", e); + throw e; + } + + } + + return null; + + } +} +>>>>>>> 6d09f43225ba2e0f6d7b0583f843c858a1015807:eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/test/eidas/specific/modules/authmodule_eIDASv2/SZRClientTest.java diff --git a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/gv/egiz/test/eidas/specific/modules/authmodule_eIDASv2/SZRClientTest.java b/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/gv/egiz/test/eidas/specific/modules/authmodule_eIDASv2/SZRClientTest.java deleted file mode 100644 index 09fe59e5..00000000 --- a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/gv/egiz/test/eidas/specific/modules/authmodule_eIDASv2/SZRClientTest.java +++ /dev/null @@ -1,172 +0,0 @@ -//package at.gv.egiz.test.eidas.specific.modules.authmodule_eIDASv2; -// -//import java.io.IOException; -//import java.math.BigInteger; -//import java.security.InvalidKeyException; -//import java.security.NoSuchProviderException; -//import java.security.PublicKey; -//import java.security.interfaces.RSAPublicKey; -//import java.util.ArrayList; -//import java.util.List; -// -//import org.apache.commons.lang3.StringUtils; -//import org.junit.Test; -//import org.junit.runner.RunWith; -//import org.slf4j.Logger; -//import org.slf4j.LoggerFactory; -//import org.springframework.beans.factory.annotation.Autowired; -//import org.springframework.test.context.ContextConfiguration; -//import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -//import org.springframework.util.Base64Utils; -//import org.w3._2000._09.xmldsig.KeyValueType; -//import org.w3._2000._09.xmldsig.RSAKeyValueType; -//import org.w3c.dom.Element; -// -//import at.gv.e_government.reference.namespace.persondata._20020228.PersonNameType; -//import at.gv.e_government.reference.namespace.persondata._20020228.PhysicalPersonType; -//import at.gv.egiz.eaaf.core.api.data.EAAFConstants; -//import at.gv.egiz.eaaf.core.api.idp.IConfiguration; -//import at.gv.egiz.eaaf.core.api.idp.auth.data.IIdentityLink; -//import at.gv.egiz.eaaf.core.exceptions.EAAFParserException; -//import at.gv.egiz.eaaf.core.impl.data.Trible; -//import at.gv.egiz.eaaf.core.impl.idp.auth.data.SimpleIdentityLinkAssertionParser; -//import at.gv.egiz.eidas.specific.modules.authmodule_eIDASv2.Constants; -//import at.gv.egiz.eidas.specific.modules.authmodule_eIDASv2.exception.SZRCommunicationException; -//import at.gv.egiz.eidas.specific.modules.authmodule_eIDASv2.szr.SZRClient; -//import at.gv.egiz.eidas.specific.modules.authmodule_eIDASv2.utils.eIDASResponseUtils; -//import szrservices.IdentityLinkType; -//import szrservices.PersonInfoType; -//import szrservices.SZRException_Exception; -//import szrservices.TravelDocumentType; -// -//@RunWith(SpringJUnit4ClassRunner.class) -//@ContextConfiguration("/SpringTest-context_basic_test.xml") -//public class SZRClientTest { -// private static final Logger log = LoggerFactory.getLogger(SZRClientTest.class); -// -// @Autowired SZRClient szrClient; -// @Autowired IConfiguration basicConfig; -// -// private static final String givenName = "Franz"; -// private static final String familyName = "Mustermann"; -// private static final String dateOfBirth = "1987-05-05"; -// private static final String eIDASeID = "IS/AT/123456789ABCDE"; -// -// private static final String DUMMY_TARGET = EAAFConstants.URN_PREFIX_CDID + "ZP"; -// -// @Test -// public void dummyTest() { -// -// } -// -// -// //@Test -// public void getIdentityLink() throws SZRException_Exception, EAAFParserException, NoSuchProviderException, IOException, InvalidKeyException, SZRCommunicationException { -// log.debug("Starting connecting SZR Gateway"); -// IdentityLinkType result = szrClient.getIdentityLink( -// getPersonInfo(), -// dummyCodeForKeys(), -// basicConfig.getBasicMOAIDConfigurationBoolean( -// Constants.CONIG_PROPS_EIDAS_SZRCLIENT_DEBUG_INSERTERNB, -// true) -// ); -// -// Element idlFromSZR = (Element)result.getAssertion(); -// IIdentityLink identityLink = new SimpleIdentityLinkAssertionParser(idlFromSZR).parseIdentityLink(); -// if (identityLink == null) -// throw new SZRCommunicationException("ernb.00", new Object[] {"bPK is null or empty"}); -// -// } -// -// //@Test -// public void getbPKTest() throws SZRException_Exception, SZRCommunicationException { -// String bPK = szrClient.getBPK(getPersonInfo(), DUMMY_TARGET, -// basicConfig.getBasicConfiguration( -// Constants.CONIG_PROPS_EIDAS_SZRCLIENT_PARAMS_VKZ, -// "no VKZ defined")); -// -// if (StringUtils.isEmpty(bPK)) -// throw new SZRCommunicationException("ernb.01", new Object[] {"bPK is null or empty"}); -// -// -// } -// -// private PersonInfoType getPersonInfo() { -// PersonInfoType personInfo = new PersonInfoType(); -// PersonNameType personName = new PersonNameType(); -// PhysicalPersonType naturalPerson = new PhysicalPersonType(); -// TravelDocumentType eDocument = new TravelDocumentType(); -// -// naturalPerson.setName(personName ); -// personInfo.setPerson(naturalPerson ); -// personInfo.setTravelDocument(eDocument ); -// -// //parse some eID attributes -// Trible<String, String, String> eIdentifier = -// eIDASResponseUtils.parseEidasPersonalIdentifier((String)eIDASeID); -// String uniqueId = (String)eIDASeID; -// String citizenCountry = eIdentifier.getFirst(); -// -// //person information -// personName.setFamilyName((String)familyName); -// personName.setGivenName((String)givenName); -// naturalPerson.setDateOfBirth(dateOfBirth); -// eDocument.setIssuingCountry(citizenCountry); -// eDocument.setDocumentNumber(uniqueId); -// -// //eID document information -// eDocument.setDocumentType(basicConfig.getBasicConfiguration( -// Constants.CONIG_PROPS_EIDAS_SZRCLIENT_PARAMS_EDOCUMENTTYPE, -// Constants.SZR_CONSTANTS_DEFAULT_DOCUMENT_TYPE)); -// -// //TODO: that should be removed -// eDocument.setIssueDate(basicConfig.getBasicConfiguration( -// Constants.CONIG_PROPS_EIDAS_SZRCLIENT_PARAMS_ISSUING_DATE, -// Constants.SZR_CONSTANTS_DEFAULT_ISSUING_DATE)); -// eDocument.setIssuingAuthority(basicConfig.getBasicConfiguration( -// Constants.CONIG_PROPS_EIDAS_SZRCLIENT_PARAMS_ISSUING_AUTHORITY, -// Constants.SZR_CONSTANTS_DEFAULT_ISSUING_AUTHORITY)); -// -// return personInfo; -// } -// -// -// private List<KeyValueType> dummyCodeForKeys() throws IOException, NoSuchProviderException, InvalidKeyException { -// if (basicConfig.getBasicMOAIDConfigurationBoolean( -// Constants.CONIG_PROPS_EIDAS_SZRCLIENT_PARAMS_KEYS_USEDUMMY, -// false)) { -// List<KeyValueType> keyvalueList = new ArrayList<KeyValueType>(); -// try { -// //Security.addProvider(new BouncyCastleProvider()); -// //PKCS8EncodedKeySpec spec = new PKCS8EncodedKeySpec(Constants.SZR_CONSTANTS_DEFAULT_PUBL_KEY); -// //KeyFactory kf = KeyFactory.getInstance("RSA", "BC"); -// -// //PublicKey pb = kf.generatePublic(spec); -// PublicKey pb = new iaik.security.rsa.RSAPublicKey(Constants.SZR_CONSTANTS_DEFAULT_PUBL_KEY); -// -// RSAPublicKey rsapb = (RSAPublicKey)pb; -// BigInteger modulus = rsapb.getModulus(); -// BigInteger exponent = rsapb.getPublicExponent(); -// -// // set key values -// RSAKeyValueType rsa = new RSAKeyValueType(); -// rsa.setExponent(new String(Base64Utils.encode(exponent.toByteArray()))); -// rsa.setModulus(new String(Base64Utils.encode(modulus.toByteArray()))); -// -// KeyValueType key = new KeyValueType(); -// key.setRSAKeyValue(rsa); -// -// keyvalueList.add(key); -// -// return keyvalueList; -// } catch (Exception e) { -// log.error("TestCode has an internal ERROR", e); -// throw e; -// } -// -// } -// -// return null; -// -// } -//} |