Search in sources :

Example 6 with InternationalStringType

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);
}
Also used : WSMarshaller(org.openecard.ws.marshal.WSMarshaller) Document(org.w3c.dom.Document) InternationalStringType(oasis.names.tc.dss._1_0.core.schema.InternationalStringType) Result(oasis.names.tc.dss._1_0.core.schema.Result) Test(org.testng.annotations.Test)

Example 7 with InternationalStringType

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);
}
Also used : EAC1OutputType(iso.std.iso_iec._24727.tech.schema.EAC1OutputType) DIDAuthenticateResponse(iso.std.iso_iec._24727.tech.schema.DIDAuthenticateResponse) DocumentBuilderFactory(javax.xml.parsers.DocumentBuilderFactory) DocumentBuilder(javax.xml.parsers.DocumentBuilder) Element(org.w3c.dom.Element) StringReader(java.io.StringReader) WSMarshaller(org.openecard.ws.marshal.WSMarshaller) Document(org.w3c.dom.Document) InternationalStringType(oasis.names.tc.dss._1_0.core.schema.InternationalStringType) Result(oasis.names.tc.dss._1_0.core.schema.Result) Test(org.testng.annotations.Test)

Example 8 with InternationalStringType

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));
}
Also used : DIDAuthenticateResponse(iso.std.iso_iec._24727.tech.schema.DIDAuthenticateResponse) DocumentBuilderFactory(javax.xml.parsers.DocumentBuilderFactory) DocumentBuilder(javax.xml.parsers.DocumentBuilder) Version(de.bund.bsi.ecard.api._1.InitializeFrameworkResponse.Version) InitializeFrameworkResponse(de.bund.bsi.ecard.api._1.InitializeFrameworkResponse) Element(org.w3c.dom.Element) BigInteger(java.math.BigInteger) Document(org.w3c.dom.Document) InternationalStringType(oasis.names.tc.dss._1_0.core.schema.InternationalStringType) Result(oasis.names.tc.dss._1_0.core.schema.Result) EAC2OutputType(iso.std.iso_iec._24727.tech.schema.EAC2OutputType) Test(org.testng.annotations.Test)

Example 9 with InternationalStringType

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;
    }
}
Also used : CardInfoType(iso.std.iso_iec._24727.tech.schema.CardInfoType) CardTypeType(iso.std.iso_iec._24727.tech.schema.CardTypeType) InternationalStringType(oasis.names.tc.dss._1_0.core.schema.InternationalStringType)

Example 10 with InternationalStringType

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;
}
Also used : InternationalStringType(oasis.names.tc.dss._1_0.core.schema.InternationalStringType) Result(oasis.names.tc.dss._1_0.core.schema.Result)

Aggregations

InternationalStringType (oasis.names.tc.dss._1_0.core.schema.InternationalStringType)17 Result (oasis.names.tc.dss._1_0.core.schema.Result)11 Test (org.testng.annotations.Test)8 Document (org.w3c.dom.Document)8 DIDAuthenticateResponse (iso.std.iso_iec._24727.tech.schema.DIDAuthenticateResponse)6 IOException (java.io.IOException)5 Element (org.w3c.dom.Element)5 EAC2OutputType (iso.std.iso_iec._24727.tech.schema.EAC2OutputType)4 WSMarshaller (org.openecard.ws.marshal.WSMarshaller)4 InitializeFrameworkResponse (de.bund.bsi.ecard.api._1.InitializeFrameworkResponse)3 EstablishChannelResponse (iso.std.iso_iec._24727.tech.schema.EstablishChannelResponse)3 LocalizedString (org.openecard.addon.manifest.LocalizedString)3 XmlPullParserException (org.xmlpull.v1.XmlPullParserException)3 BeginTransaction (iso.std.iso_iec._24727.tech.schema.BeginTransaction)2 BeginTransactionResponse (iso.std.iso_iec._24727.tech.schema.BeginTransactionResponse)2 CardApplicationConnect (iso.std.iso_iec._24727.tech.schema.CardApplicationConnect)2 CardApplicationConnectResponse (iso.std.iso_iec._24727.tech.schema.CardApplicationConnectResponse)2 CardApplicationDisconnect (iso.std.iso_iec._24727.tech.schema.CardApplicationDisconnect)2 CardApplicationDisconnectResponse (iso.std.iso_iec._24727.tech.schema.CardApplicationDisconnectResponse)2 CardApplicationPath (iso.std.iso_iec._24727.tech.schema.CardApplicationPath)2