package at.gv.egiz.pdfas.api.internal;
import java.util.Map;
import at.gv.egiz.pdfas.api.PdfAs;
import at.gv.egiz.pdfas.api.analyze.AnalyzeResult;
import at.gv.egiz.pdfas.api.commons.SignatureInformation;
import at.gv.egiz.pdfas.api.exceptions.PdfAsException;
import at.gv.egiz.pdfas.api.sign.SignParameters;
import at.gv.egiz.pdfas.api.sign.SignResult;
import at.gv.egiz.pdfas.api.sign.SignatureDetailInformation;
import at.gv.egiz.pdfas.api.verify.VerifyResult;
import at.knowcenter.wag.egov.egiz.exceptions.ConnectorException;
import at.knowcenter.wag.egov.egiz.exceptions.ConnectorFactoryException;
import at.knowcenter.wag.egov.egiz.exceptions.NormalizeException;
import at.knowcenter.wag.egov.egiz.exceptions.SettingsException;
import at.knowcenter.wag.egov.egiz.exceptions.SignatureException;
import at.knowcenter.wag.egov.egiz.exceptions.SignatureTypesException;
/**
* The methods of this interface are used by the pdf-as-web project and are not for external use.
* Using this API is inadvisable as its functionality might change without notice from release to release.
*
* @author exthex
*
*/
public interface PdfAsInternal {
/**
* Check if a BKU with the given parameters is supported.
*
* @param bkuParams
* @throws ConnectorException if the BKU is not supported
* @throws SettingsException if the BKU is not supported
*/
public void verifyBKUSupport(LocalBKUParams bkuParams) throws ConnectorException, SettingsException;
/**
* Finish the sign process.
*
* @param pdfAs
* @param signParameters
* @param sdi This info will most likely come from a {@link PdfAs#prepareSign(SignParameters)} call
* @param bkuParams
* @param xmlResponse the SecurityLayer response from the BKU
* @return the signed document + additional info
* @throws PdfAsException
*/
public SignResult finishLocalSign(PdfAs pdfAs, SignParameters signParameters, SignatureDetailInformation sdi, LocalBKUParams bkuParams, String xmlResponse) throws PdfAsException;
/**
* Get the security layer address for the given connector. (zB: http://127.0.0.1:3495/http-security-layer-request)
*
* @param profile
* @param device
* @return
* @throws SettingsException
*/
public String getLocalServiceAddress(String profile, String device) throws SettingsException;
/**
* Get the CreateXMLSignatureRequest for the given parameters.
*
* @param signParameters the sign parameters. {@link SignParameters#getSignatureDevice()} determines the connector to use.
* @param loc_ref_url the URL where to retrieve the PDF to sign
* @param sdi {@link SignatureDetailInformation#getSignatureData()} provides the data to be signed.
* @return
* @throws ConnectorException
*/
public String prepareLocalSignRequest(SignParameters signParameters, String loc_ref_url, SignatureDetailInformation sdi) throws ConnectorException;
/**
* Create an AnalyzeResult from raw text, instead of a PDF.
*
* @param rawText
* @param sigValues the signature values
* @return
* @throws SignatureException
* @throws SettingsException
* @throws SignatureTypesException
* @throws NormalizeException
*/
public AnalyzeResult analyzeFromRawText(String rawText, Map sigValues) throws SignatureException, SettingsException, SignatureTypesException, NormalizeException;
/**
* Create the SecurityLayer VerifyXMLSignatureRequest for the given parameters.
*
* @param sigInfo
* @param connector
* @param profile
* @param loc_ref_url
* @return
* @throws SignatureException
* @throws ConnectorException
*/
public String prepareLocalVerifyRequest(SignatureInformation sigInfo, String connector, String profile, String loc_ref_url) throws SignatureException, ConnectorException;
/**
* Parse the given xml_response - must be a VerifyXMLSignatureResponse - from the BKU or Mocca and generates a VerifyResult from it.
*
* @param sigInfo
* @param connector
* @param profile
* @param loc_ref_url
* @param xmlResponse
* @return
* @throws SignatureException
* @throws ConnectorException
*/
public VerifyResult finishLocalVerify(SignatureInformation sigInfo, String connector, String profile, String loc_ref_url, String xmlResponse) throws SignatureException, ConnectorException;
/**
* Get the {@link SignatureEntry} corresponding to a given {@link SignatureInformation}
*
* @param key
* @param sigInfo
* @return
*/
public SignatureEntry getSignatureEntryFromSignatureInformation(String key, SignatureInformation sigInfo);
/**
* Get the signed text for a given sigInfo.
* If this signature is not text based this method will return null.
*
* @param sigInfo
* @return
*/
public String getSignedText(SignatureInformation sigInfo);
/**
* Get a map of all connectors available for web.
* The key is the connector id, the value is the description.
*
* @return
* @throws ConnectorFactoryException
*/
public Map getConnectorsAvailableForWeb() throws ConnectorFactoryException;
}