package at.gv.egovernment.moa.id.auth.builder; import java.io.IOException; import at.gv.egovernment.moa.id.BuildException; import at.gv.egovernment.moa.util.FileUtils; /** * Builder for the <VerifyXMLSignatureRequest> structure * used for presenting certificate information in the secure viewer of the security layer implementation. * * @author Paul Ivancsics * @version $Id$ */ public class CertInfoVerifyXMLSignatureRequestBuilder extends Builder { /** special tag in the VerifyXMLRequest template to be substituted for a <dsig:Signature> */ private static final String SIGNATURE_TAG = ""; /** * Constructor */ public CertInfoVerifyXMLSignatureRequestBuilder() { super(); } /** * Builds the <VerifyXMLSignatureRequest> structure. * @return the XML structure * @throws BuildException */ public String build() throws BuildException { String resCertInfoRequest = "resources/xmldata/CertInfoVerifyXMLSignatureRequest.xml"; String resDsigSignature = "resources/xmldata/CertInfoDsigSignature.xml"; String certInfoRequest; try { certInfoRequest = FileUtils.readResource(resCertInfoRequest, "UTF-8"); } catch (IOException ex) { throw new BuildException("auth.04", new Object[] {resCertInfoRequest, ex.toString()}); } try { String dsigSignature = FileUtils.readResource(resDsigSignature, "UTF-8"); certInfoRequest = replaceTag(certInfoRequest, SIGNATURE_TAG, dsigSignature); return certInfoRequest; } catch (IOException ex) { throw new BuildException("auth.04", new Object[] {resDsigSignature, ex.toString()}); } } }