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.Files;
30 import java.nio.file.Paths;
31 import java.util.Optional;
32 import java.util.logging.Level;
55 if (licenseResponse != null) {
58 licenseFile.getParentFile().mkdirs();
59 objectMapper.writeValue(licenseFile, licenseResponse);
61 }
catch (IOException ex) {
62 logger.log(Level.WARNING,
"There was an error writing CyberTriage license to file: " + licenseFile.getAbsolutePath(), ex);
70 Optional<LicenseResponse> toRet = Optional.empty();
72 if (licenseFile.exists() && licenseFile.isFile()) {
74 toRet = Optional.ofNullable(objectMapper.readValue(licenseFile,
LicenseResponse.class));
75 }
catch (IOException ex) {
76 logger.log(Level.WARNING,
"There was an error reading CyberTriage license to file: " + licenseFile.getAbsolutePath(), ex);
88 logger.log(Level.WARNING,
"There was an error decrypting license data from license file", ex);
89 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 LicenseDecryptorUtil getInstance()
final ObjectMapper objectMapper
synchronized Optional< LicenseResponse > loadLicenseResponse()
synchronized static Logger getLogger(String name)
LicenseInfo createLicenseInfo(LicenseResponse licenseResponse)