@Test(expectedExceptions = AggregationHashChainPrependingException.class, expectedExceptionsMessageRegExp = "The aggregation hash chain cannot be added as lowest level chain. " + "Its output hash .* does not match base signature input hash .*") public void testCreateSignatureWithInvalidOutputHash_throwsKSIException() throws Exception { AggregationHashChain chain = new InMemoryAggregationHashChain(loadTlv(AGGREGATION_HASH_CHAIN_WITH_HEIGHT_2)); KSISignature signature = TestUtil.loadSignature(SIGNATURE_WITH_LEVEL_CORRECTION_3); signatureFactory.createSignature(signature, chain, null); }
public KSISignature createSignature(InputStream input) throws KSIException { TLVInputStream tlvInput = new TLVInputStream(input); try { return createSignature(tlvInput.readElement(), extendingAllowed, null); } catch (IOException e) { throw new KSIException("Reading signature data from input stream failed", e); } finally { Util.closeQuietly(tlvInput); } }
InMemoryKsiSignatureFactory implements KSISignatureFactory { public KSISignature createSignature(InputStream input) throws KSIException { TLVInputStream tlvInput = new TLVInputStream(input); try { return createSignature(tlvInput.readElement(), extendingAllowed, null); } catch (IOException e) { throw new KSIException("Reading signature data from input stream failed", e); } finally { Util.closeQuietly(tlvInput); } } }
InMemoryKsiSignatureFactory implements KSISignatureFactory { public KSISignature createSignature(InputStream input) throws KSIException { TLVInputStream tlvInput = new TLVInputStream(input); try { return createSignature(tlvInput.readElement(), extendingAllowed, null); } catch (IOException e) { throw new KSIException("Reading signature data from input stream failed", e); } finally { Util.closeQuietly(tlvInput); } } InMemoryKsiSignatureFactory();  InMemoryKsiSignatureFactory(KSISignatureComponentFactory signatureComponentFactory);  InMemoryKsiSignatureFactory(ContextAwarePolicy policy, KSISignatureComponentFactory signatureComponentFactory); @Deprecated  InMemoryKsiSignatureFactory(Policy policy, PublicationsFileClientAdapter publicationsFileClientAdapter,
                                       KSIExtendingService extendingService, boolean extendingAllowed,
                                       KSISignatureComponentFactory signatureComponentFactory); @Deprecated  InMemoryKsiSignatureFactory(Policy policy, PublicationsFileClientAdapter publicationsFileClientAdapter,
                                       KSIExtenderClient extenderClient, boolean extendingAllowed,
                                       KSISignatureComponentFactory signatureComponentFactory); @Deprecated  InMemoryKsiSignatureFactory(Policy policy, PublicationsFileClientAdapter publicationsFileClientAdapter,
                                       KSIExtenderClient extenderClient, boolean extendingAllowed,  PduFactory pduFactory,
                                       KSISignatureComponentFactory signatureComponentFactory); }
InMemoryKsiSignatureFactory implements KSISignatureFactory { public KSISignature createSignature(InputStream input) throws KSIException { TLVInputStream tlvInput = new TLVInputStream(input); try { return createSignature(tlvInput.readElement(), extendingAllowed, null); } catch (IOException e) { throw new KSIException("Reading signature data from input stream failed", e); } finally { Util.closeQuietly(tlvInput); } } InMemoryKsiSignatureFactory();  InMemoryKsiSignatureFactory(KSISignatureComponentFactory signatureComponentFactory);  InMemoryKsiSignatureFactory(ContextAwarePolicy policy, KSISignatureComponentFactory signatureComponentFactory); @Deprecated  InMemoryKsiSignatureFactory(Policy policy, PublicationsFileClientAdapter publicationsFileClientAdapter,
                                       KSIExtendingService extendingService, boolean extendingAllowed,
                                       KSISignatureComponentFactory signatureComponentFactory); @Deprecated  InMemoryKsiSignatureFactory(Policy policy, PublicationsFileClientAdapter publicationsFileClientAdapter,
                                       KSIExtenderClient extenderClient, boolean extendingAllowed,
                                       KSISignatureComponentFactory signatureComponentFactory); @Deprecated  InMemoryKsiSignatureFactory(Policy policy, PublicationsFileClientAdapter publicationsFileClientAdapter,
                                       KSIExtenderClient extenderClient, boolean extendingAllowed,  PduFactory pduFactory,
                                       KSISignatureComponentFactory signatureComponentFactory); KSISignature createSignature(InputStream input); KSISignature createSignature(TLVElement element, DataHash inputHash); KSISignature createSignature(TLVElement element, DataHash inputHash, long level); KSISignature createSignature(List<AggregationHashChain> aggregationHashChains,
                                        CalendarHashChain calendarChain, CalendarAuthenticationRecord calendarAuthenticationRecord,
                                        PublicationRecord signaturePublicationRecord, RFC3161Record rfc3161Record); KSISignature createSignature(KSISignature signature, AggregationHashChain aggregationHashChain,
                                        DataHash originalInputHash); }
InMemoryKsiSignatureFactory implements KSISignatureFactory { public KSISignature createSignature(InputStream input) throws KSIException { TLVInputStream tlvInput = new TLVInputStream(input); try { return createSignature(tlvInput.readElement(), extendingAllowed, null); } catch (IOException e) { throw new KSIException("Reading signature data from input stream failed", e); } finally { Util.closeQuietly(tlvInput); } } InMemoryKsiSignatureFactory();  InMemoryKsiSignatureFactory(KSISignatureComponentFactory signatureComponentFactory);  InMemoryKsiSignatureFactory(ContextAwarePolicy policy, KSISignatureComponentFactory signatureComponentFactory); @Deprecated  InMemoryKsiSignatureFactory(Policy policy, PublicationsFileClientAdapter publicationsFileClientAdapter,
                                       KSIExtendingService extendingService, boolean extendingAllowed,
                                       KSISignatureComponentFactory signatureComponentFactory); @Deprecated  InMemoryKsiSignatureFactory(Policy policy, PublicationsFileClientAdapter publicationsFileClientAdapter,
                                       KSIExtenderClient extenderClient, boolean extendingAllowed,
                                       KSISignatureComponentFactory signatureComponentFactory); @Deprecated  InMemoryKsiSignatureFactory(Policy policy, PublicationsFileClientAdapter publicationsFileClientAdapter,
                                       KSIExtenderClient extenderClient, boolean extendingAllowed,  PduFactory pduFactory,
                                       KSISignatureComponentFactory signatureComponentFactory); KSISignature createSignature(InputStream input); KSISignature createSignature(TLVElement element, DataHash inputHash); KSISignature createSignature(TLVElement element, DataHash inputHash, long level); KSISignature createSignature(List<AggregationHashChain> aggregationHashChains,
                                        CalendarHashChain calendarChain, CalendarAuthenticationRecord calendarAuthenticationRecord,
                                        PublicationRecord signaturePublicationRecord, RFC3161Record rfc3161Record); KSISignature createSignature(KSISignature signature, AggregationHashChain aggregationHashChain,
                                        DataHash originalInputHash);  }