@Test public void getAnchorFileFromBytes() throws Exception { byte[] anchorBytes = FileUtils.readFileToByteArray(ANCHOR_FILE); AnchorFile anchorFile = systemService.getAnchorFileFromBytes(anchorBytes, true); assertEquals(ANCHOR_HASH, anchorFile.getHash()); }
public AnchorFile getAnchorFileFromBytes(byte[] anchorBytes, boolean shouldVerifyAnchorInstance) throws InvalidAnchorInstanceException, MalformedAnchorException { ConfigurationAnchorV2 anchor = createAnchorFromBytes(anchorBytes); if (shouldVerifyAnchorInstance) { verifyAnchorInstance(anchor); } AnchorFile anchorFile = new AnchorFile(calculateAnchorHexHash(anchorBytes)); anchorFile.setCreatedAt(FormatUtils.fromDateToOffsetDateTime(anchor.getGeneratedAt())); return anchorFile; }
SystemService { public AnchorFile getAnchorFileFromBytes(byte[] anchorBytes, boolean shouldVerifyAnchorInstance) throws InvalidAnchorInstanceException, MalformedAnchorException { ConfigurationAnchorV2 anchor = createAnchorFromBytes(anchorBytes); if (shouldVerifyAnchorInstance) { verifyAnchorInstance(anchor); } AnchorFile anchorFile = new AnchorFile(calculateAnchorHexHash(anchorBytes)); anchorFile.setCreatedAt(FormatUtils.fromDateToOffsetDateTime(anchor.getGeneratedAt())); return anchorFile; } }
SystemService { public AnchorFile getAnchorFileFromBytes(byte[] anchorBytes, boolean shouldVerifyAnchorInstance) throws InvalidAnchorInstanceException, MalformedAnchorException { ConfigurationAnchorV2 anchor = createAnchorFromBytes(anchorBytes); if (shouldVerifyAnchorInstance) { verifyAnchorInstance(anchor); } AnchorFile anchorFile = new AnchorFile(calculateAnchorHexHash(anchorBytes)); anchorFile.setCreatedAt(FormatUtils.fromDateToOffsetDateTime(anchor.getGeneratedAt())); return anchorFile; } @Autowired  SystemService(GlobalConfService globalConfService, ServerConfService serverConfService,
            AnchorRepository anchorRepository, ConfigurationVerifier configurationVerifier,
            CurrentSecurityServerId currentSecurityServerId,
            AuditDataHelper auditDataHelper); }
SystemService { public AnchorFile getAnchorFileFromBytes(byte[] anchorBytes, boolean shouldVerifyAnchorInstance) throws InvalidAnchorInstanceException, MalformedAnchorException { ConfigurationAnchorV2 anchor = createAnchorFromBytes(anchorBytes); if (shouldVerifyAnchorInstance) { verifyAnchorInstance(anchor); } AnchorFile anchorFile = new AnchorFile(calculateAnchorHexHash(anchorBytes)); anchorFile.setCreatedAt(FormatUtils.fromDateToOffsetDateTime(anchor.getGeneratedAt())); return anchorFile; } @Autowired  SystemService(GlobalConfService globalConfService, ServerConfService serverConfService,
            AnchorRepository anchorRepository, ConfigurationVerifier configurationVerifier,
            CurrentSecurityServerId currentSecurityServerId,
            AuditDataHelper auditDataHelper); List<TspType> getConfiguredTimestampingServices(); void addConfiguredTimestampingService(TspType tspTypeToAdd); void deleteConfiguredTimestampingService(TspType tspTypeToDelete); byte[] generateInternalCsr(String distinguishedName); AnchorFile getAnchorFile(); AnchorFile getAnchorFileFromBytes(byte[] anchorBytes, boolean shouldVerifyAnchorInstance); void uploadInitialAnchor(byte[] anchorBytes); void replaceAnchor(byte[] anchorBytes); boolean isAnchorImported(); byte[] readAnchorFile(); String getAnchorFilenameForDownload(); }
SystemService { public AnchorFile getAnchorFileFromBytes(byte[] anchorBytes, boolean shouldVerifyAnchorInstance) throws InvalidAnchorInstanceException, MalformedAnchorException { ConfigurationAnchorV2 anchor = createAnchorFromBytes(anchorBytes); if (shouldVerifyAnchorInstance) { verifyAnchorInstance(anchor); } AnchorFile anchorFile = new AnchorFile(calculateAnchorHexHash(anchorBytes)); anchorFile.setCreatedAt(FormatUtils.fromDateToOffsetDateTime(anchor.getGeneratedAt())); return anchorFile; } @Autowired  SystemService(GlobalConfService globalConfService, ServerConfService serverConfService,
            AnchorRepository anchorRepository, ConfigurationVerifier configurationVerifier,
            CurrentSecurityServerId currentSecurityServerId,
            AuditDataHelper auditDataHelper); List<TspType> getConfiguredTimestampingServices(); void addConfiguredTimestampingService(TspType tspTypeToAdd); void deleteConfiguredTimestampingService(TspType tspTypeToDelete); byte[] generateInternalCsr(String distinguishedName); AnchorFile getAnchorFile(); AnchorFile getAnchorFileFromBytes(byte[] anchorBytes, boolean shouldVerifyAnchorInstance); void uploadInitialAnchor(byte[] anchorBytes); void replaceAnchor(byte[] anchorBytes); boolean isAnchorImported(); byte[] readAnchorFile(); String getAnchorFilenameForDownload();  }