19 package com.basistech.df.cybertriage.autopsy.ctoptions.ctcloud;
25 import com.fasterxml.jackson.core.JsonProcessingException;
26 import com.fasterxml.jackson.databind.ObjectMapper;
28 import java.io.IOException;
29 import java.nio.file.Paths;
30 import java.util.Optional;
31 import java.util.logging.Level;
56 if (licenseFile.exists()) {
57 return licenseFile.delete();
64 if (licenseResponse != null) {
67 licenseFile.getParentFile().mkdirs();
68 objectMapper.writeValue(licenseFile, licenseResponse);
70 }
catch (IOException ex) {
71 logger.log(Level.WARNING,
"There was an error writing CyberTriage license to file: " + licenseFile.getAbsolutePath(), ex);
79 Optional<LicenseResponse> toRet = Optional.empty();
81 if (licenseFile.exists() && licenseFile.isFile()) {
83 toRet = Optional.ofNullable(objectMapper.readValue(licenseFile,
LicenseResponse.class));
84 }
catch (IOException ex) {
85 logger.log(Level.WARNING,
"There was an error reading CyberTriage license to file: " + licenseFile.getAbsolutePath(), ex);
97 logger.log(Level.WARNING,
"There was an error decrypting license data from license file", ex);
98 return Optional.empty();
static final Logger logger
static ObjectMapperUtil getInstance()
static final String CT_LICENSE_FILENAME
static final String CT_SETTINGS_DIR
synchronized boolean saveLicenseResponse(LicenseResponse licenseResponse)
static final CTLicensePersistence instance
synchronized Optional< LicenseInfo > loadLicenseInfo()
static CTLicensePersistence getInstance()
ObjectMapper getDefaultObjectMapper()
static final String MALWARE_INGEST_SETTINGS_FILENAME
static LicenseDecryptorUtil getInstance()
final ObjectMapper objectMapper
synchronized Optional< LicenseResponse > loadLicenseResponse()
File getMalwareIngestFile()
synchronized boolean deleteLicenseResponse()
synchronized static Logger getLogger(String name)
LicenseInfo createLicenseInfo(LicenseResponse licenseResponse)