From f51caf2aafe4a5bdc4383d08f74036f6be3cc31b Mon Sep 17 00:00:00 2001 From: Thomas Lenz Date: Wed, 2 Nov 2016 12:02:28 +0100 Subject: add first parts of new Trust-Status List module (version 2.0) integration - contains only API and WebService scheme updates but not functional integration --- .../moa/spss/api/xmlbind/ResponseBuilderUtils.java | 57 +++++++++++++++++++++- 1 file changed, 55 insertions(+), 2 deletions(-) (limited to 'moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/ResponseBuilderUtils.java') diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/ResponseBuilderUtils.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/ResponseBuilderUtils.java index ef5a367..79a674e 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/ResponseBuilderUtils.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/api/xmlbind/ResponseBuilderUtils.java @@ -48,8 +48,10 @@ import iaik.utils.RFC2253NameParserException; import at.gv.egovernment.moa.spss.MOAApplicationException; import at.gv.egovernment.moa.spss.MOASystemException; import at.gv.egovernment.moa.spss.api.common.ExtendedCertificateCheckResult; +import at.gv.egovernment.moa.spss.api.common.TslInfos; import at.gv.egovernment.moaspss.util.Base64Utils; import at.gv.egovernment.moaspss.util.Constants; +import at.gv.egovernment.moaspss.util.MiscUtil; /** * Utility methods used by the verious ResponseBuilder classes. @@ -127,7 +129,8 @@ public class ResponseBuilderUtils { String publicAuthorityID, boolean isSSCD, String sscdSource, - String issuerCountryCode) + String issuerCountryCode, + TslInfos tslInfos) throws MOAApplicationException { Element signerInfoElem = response.createElementNS(MOA_NS_URI, "SignerInfo"); @@ -158,7 +161,53 @@ public class ResponseBuilderUtils { issuerCountryCodeElem = response.createElementNS(MOA_NS_URI, "IssuerCountryCode"); issuerCountryCodeElem.setTextContent(issuerCountryCode); } - + + //add TSL infos + Element tslInfoElement = null; + if (tslInfos != null) { + tslInfoElement = response.createElementNS(MOA_NS_URI, "TSLInformation"); + + //append TSL issuer country-code + if (MiscUtil.isNotEmpty(tslInfos.getTslIssuerCountry())); { + Element tslIssuerCountryCodeElem = response.createElementNS(MOA_NS_URI, "TSLIssuerCountryCode"); + tslIssuerCountryCodeElem.setTextContent(tslInfos.getTslIssuerCountry()); + tslInfoElement.appendChild(tslIssuerCountryCodeElem); + + } + + //append Service-Type Status + if (MiscUtil.isNotEmpty(tslInfos.getServiceTypeStatus())); { + Element tslServiceInfo = response.createElementNS(MOA_NS_URI, "ServiceTypeStatus"); + tslServiceInfo.setTextContent(tslInfos.getServiceTypeStatus()); + tslInfoElement.appendChild(tslServiceInfo); + + } + + //append Service-Type Identifier + if (MiscUtil.isNotEmpty(tslInfos.getServiceTypeIdentifier())); { + Element tslServiceInfo = response.createElementNS(MOA_NS_URI, "ServiceTypeIdentifier"); + tslServiceInfo.setTextContent(tslInfos.getServiceTypeIdentifier()); + tslInfoElement.appendChild(tslServiceInfo); + + } + + //append qualifiers + if (tslInfos.getQualifiers() != null && tslInfos.getQualifiers().size() > 0) { + Element tslQualifiers = response.createElementNS(MOA_NS_URI, "Qualifiers"); + + for (String el : tslInfos.getQualifiers()) { + Element tslQualifier = response.createElementNS(MOA_NS_URI, "Qualifier"); + tslQualifier.setTextContent(el); + tslQualifiers.appendChild(tslQualifier); + + } + + tslInfoElement.appendChild(tslQualifiers); + + } + + } + Element publicAuthorityElem = isPublicAuthority ? response.createElementNS(MOA_NS_URI, "PublicAuthority") @@ -215,6 +264,10 @@ public class ResponseBuilderUtils { if (issuerCountryCodeElem != null) x509DataElem.appendChild(issuerCountryCodeElem); + //add TSL infos to X509Date if TSL infos exists + if (tslInfoElement != null) + x509DataElem.appendChild(tslInfoElement); + signerInfoElem.appendChild(x509DataElem); root.appendChild(signerInfoElem); } -- cgit v1.2.3