public List<SignatureInfo> verify(byte[] data, String mimeType, byte[] originalData) throws DocumentFormatException, InvalidSignatureException { LOG.debug("content type: " + mimeType); DSSDocumentService documentService = this.servicesManager .getDocumentService(mimeType); if (null == documentService) { LOG.error("no document service for content type: " + mimeType); throw new DocumentFormatException(); } try { documentService.checkIncomingDocument(data); } catch (Exception e) { LOG.error("document check error: " + e.getMessage(), e); throw new DocumentFormatException(); } List<SignatureInfo> signatureInfos; try { signatureInfos = documentService.verifySignatures(data, originalData); } catch (Exception e) { LOG.error("error verifying signatures: " + e.getMessage(), e); throw new InvalidSignatureException(); } return signatureInfos; } }