use of oasis.names.tc.dss._1_0.core.schema.InternationalStringType in project open-ecard by ecsec.
the class AndroidMarshallerTest method testConversionOfResult.
@Test
public void testConversionOfResult() throws Exception {
Result r = new Result();
r.setResultMajor("major");
r.setResultMinor("minor");
InternationalStringType internationalStringType = new InternationalStringType();
internationalStringType.setLang("lang");
internationalStringType.setValue("value");
r.setResultMessage(internationalStringType);
WSMarshaller m = new AndroidMarshaller();
Document d = m.marshal(r);
String s = m.doc2str(d);
LOG.debug(s);
}
use of oasis.names.tc.dss._1_0.core.schema.InternationalStringType in project open-ecard by ecsec.
the class AndroidMarshallerTest method testConversionOfDIDAuthenticateResponsePACE.
@Test
public void testConversionOfDIDAuthenticateResponsePACE() throws Exception {
WSMarshaller m = new AndroidMarshaller();
DIDAuthenticateResponse didAuthResponse = new DIDAuthenticateResponse();
Result r = new Result();
r.setResultMajor("major");
r.setResultMinor("minor");
InternationalStringType internationalStringType = new InternationalStringType();
internationalStringType.setLang("en");
internationalStringType.setValue("message");
r.setResultMessage(internationalStringType);
didAuthResponse.setResult(r);
EAC1OutputType didAuthenticationDataType = new EAC1OutputType();
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
DocumentBuilder builder = factory.newDocumentBuilder();
Document d = builder.newDocument();
Element e = d.createElementNS("urn:iso:std:iso-iec:24727:tech:schema", "RetryCounter");
e.setTextContent("3");
didAuthenticationDataType.getAny().add(e);
e = d.createElementNS("urn:iso:std:iso-iec:24727:tech:schema", "CertificateHolderAuthorizationTemplate");
e.setTextContent("7F4C12060904007F00070301020253050001009800");
didAuthenticationDataType.getAny().add(e);
e = d.createElementNS("urn:iso:std:iso-iec:24727:tech:schema", "CertificationAuthorityReference");
e.setTextContent("ZZCVCAATA0001");
didAuthenticationDataType.getAny().add(e);
e = d.createElementNS("urn:iso:std:iso-iec:24727:tech:schema", "EFCardAccess");
e.setTextContent("31820264300D060804007F0007020202020102300F060A04007F00070202030202020102300F060A04007F00070202040202020101302F060804007F0007020206162341775420655041202D2042447220476D6248202D20546573746B617274652076312E303081FE060904007F0007020203023081F0060B04007F00070101050202023081E0020101302C06072A8648CE3D0101022100A9FB57DBA1EEA9BC3E660A909D838D726E3BF623D52620282013481D1F6E537730440420A9FB57DBA1EEA9BC3E660A909D838D726E3BF623D52620282013481D1F6E53740420662C61C430D84EA4FE66A7733D0B76B7BF93EBC4AF2F49256AE58101FEE92B04044104A3E8EB3CC1CFE7B7732213B23A656149AFA142C47AAFBC2B79A191562E1305F42D996C823439C56D7F7B22E14644417E69BCB6DE39D027001DABE8F35B25C9BE022100A9FB57DBA1EEA9BC3E660A909D838D718C397AA3B561A6F7901E0E82974856A70201013081FE060904007F0007020204023081F0060B04007F00070101050202023081E0020101302C06072A8648CE3D0101022100A9FB57DBA1EEA9BC3E660A909D838D726E3BF623D52620282013481D1F6E537730440420A9FB57DBA1EEA9BC3E660A909D838D726E3BF623D52620282013481D1F6E53740420662C61C430D84EA4FE66A7733D0B76B7BF93EBC4AF2F49256AE58101FEE92B04044104A3E8EB3CC1CFE7B7732213B23A656149AFA142C47AAFBC2B79A191562E1305F42D996C823439C56D7F7B22E14644417E69BCB6DE39D027001DABE8F35B25C9BE022100A9FB57DBA1EEA9BC3E660A909D838D718C397AA3B561A6F7901E0E82974856A7020101");
didAuthenticationDataType.getAny().add(e);
e = d.createElementNS("urn:iso:std:iso-iec:24727:tech:schema", "IDPICC");
e.setTextContent("4F5311EC8F92D60040EA63365E2B06C832856CDE1CE5F8B3C7E7696DAD7628BD");
didAuthenticationDataType.getAny().add(e);
didAuthResponse.setAuthenticationProtocolData(didAuthenticationDataType);
marshalLog(didAuthResponse);
Document doc = m.marshal(didAuthResponse);
String s = m.doc2str(doc);
LOG.debug(s);
StringReader sr = new StringReader(s);
DIDAuthenticateResponse didaresp = JAXB.unmarshal(sr, DIDAuthenticateResponse.class);
marshalLog(didaresp);
}
use of oasis.names.tc.dss._1_0.core.schema.InternationalStringType in project open-ecard by ecsec.
the class MarshalTest method testConversionOfDIDAuthenticatResponseAndInitializeFrameworkResponse.
@Test
public void testConversionOfDIDAuthenticatResponseAndInitializeFrameworkResponse() throws MarshallingTypeException, TransformerException, SOAPException, ParserConfigurationException {
JAXBMarshaller m = new JAXBMarshaller();
DIDAuthenticateResponse didAuthenticateResponse = new DIDAuthenticateResponse();
Result r = new Result();
r.setResultMajor("major");
r.setResultMinor("minor");
InternationalStringType internationalStringType = new InternationalStringType();
internationalStringType.setLang("en");
internationalStringType.setValue("message");
r.setResultMessage(internationalStringType);
didAuthenticateResponse.setResult(r);
EAC2OutputType didAuthenticationDataType = new EAC2OutputType();
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
DocumentBuilder builder = factory.newDocumentBuilder();
Document d = builder.newDocument();
Element e = d.createElementNS("urn:iso:std:iso-iec:24727:tech:schema", "Signature");
e.setTextContent("7117D7BF95D8D6BD437A0D43DE48F42528273A98F2605758D6A3A2BFC38141E7577CABB4F8FBC8DF152E3A097D1B3A703597331842425FE4A9D0F1C9067AC4A9");
didAuthenticationDataType.getAny().add(e);
didAuthenticateResponse.setAuthenticationProtocolData(didAuthenticationDataType);
Document doc = m.marshal(didAuthenticateResponse);
// test ok if this works
System.out.println(m.doc2str(doc));
InitializeFrameworkResponse initializeFrameworkResponse = new InitializeFrameworkResponse();
Version version = new Version();
version.setMajor(new BigInteger("11"));
version.setMinor(new BigInteger("22"));
version.setSubMinor(new BigInteger("33"));
initializeFrameworkResponse.setVersion(version);
r.setResultMessage(internationalStringType);
initializeFrameworkResponse.setResult(r);
doc = m.marshal(initializeFrameworkResponse);
// test ok if this works
System.out.println(m.doc2str(doc));
}
use of oasis.names.tc.dss._1_0.core.schema.InternationalStringType in project open-ecard by ecsec.
the class Status method resolveCardType.
private String resolveCardType(String cardType) {
if (cardType.equals("http://bsi.bund.de/cif/unknown")) {
return lang.translationForKey("status.unknowncard");
} else {
// read CardTypeName from CardInfo file
String cardTypeName = cardType;
CardInfoType cif = env.getCIFProvider().getCardInfo(cardType);
if (cif != null) {
CardTypeType type = cif.getCardType();
if (type != null) {
boolean found = false;
String[] languages = new String[] { Locale.getDefault().getLanguage(), "en" };
// check native lang, then english
for (String language : languages) {
if (found) {
// stop when the inner loop terminated
break;
}
List<InternationalStringType> cardTypeNames = type.getCardTypeName();
for (InternationalStringType ist : cardTypeNames) {
if (ist.getLang().equalsIgnoreCase(language)) {
cardTypeName = ist.getValue();
found = true;
break;
}
}
}
}
}
return cardTypeName;
}
}
use of oasis.names.tc.dss._1_0.core.schema.InternationalStringType in project open-ecard by ecsec.
the class WSHelper method makeResult.
public static Result makeResult(String major, String minor, String message, String lang) {
Result r = new Result();
r.setResultMajor(major);
r.setResultMinor(minor);
if (message != null) {
InternationalStringType msg = new InternationalStringType();
msg.setValue(message);
msg.setLang(lang);
r.setResultMessage(msg);
}
return r;
}
Aggregations