InMemoryKsiSignature extends TLVStructure implements KSISignature { public Identity[] getAggregationHashChainIdentity() { List<Identity> identities = new LinkedList<>(); for (int i = aggregationChains.size()-1; i>=0 ; i--) { AggregationHashChain chain = aggregationChains.get(i); identities.addAll(Arrays.asList(chain.getIdentity())); } return identities.toArray(new Identity[identities.size()]); } InMemoryKsiSignature(TLVElement element); final DataHash getInputHash(); AggregationHashChain getLastAggregationHashChain(); boolean isPublished(); String getIdentity(); Identity[] getAggregationHashChainIdentity(); boolean isExtended(); Date getAggregationTime(); Date getPublicationTime(); AggregationHashChain[] getAggregationHashChains(); @Override int getElementType(); InMemorySignaturePublicationRecord getPublicationRecord(); PublicationData getPublicationData(); CalendarAuthenticationRecord getCalendarAuthenticationRecord(); InMemoryCalendarHashChain getCalendarHashChain(); RFC3161Record getRfc3161Record(); static final int ELEMENT_TYPE; }
@Test public void testSignatureContainsIdentity_Ok() throws Exception { KSISignature signature = load(TestUtil.load(SIGNATURE_AGGREGATION_HASH_CHAIN_CHANGED_CHAIN_ORDER)); Assert.assertNotNull(signature.getAggregationHashChainIdentity()); Identity[] chainIdentity = signature.getAggregationHashChainIdentity(); Assert.assertNotNull(chainIdentity); Assert.assertEquals(chainIdentity[0].getDecodedClientId(), "GT"); Assert.assertEquals(chainIdentity[0].getType(), IdentityType.LEGACY); Assert.assertEquals(chainIdentity[chainIdentity.length-1].getDecodedClientId(), "anon"); Assert.assertEquals(chainIdentity[chainIdentity.length-1].getType(),IdentityType.METADATA); }