use of org.jkiss.dbeaver.runtime.encode.ContentEncrypter in project dbeaver by serge-rider.
the class DataSourceSerializerModern method saveConfigFile.
private void saveConfigFile(File configFile, String contents, boolean teamPrivate, boolean encrypt) {
try {
byte[] binaryContents;
if (encrypt) {
// Serialize and encrypt
ContentEncrypter encrypter = new ContentEncrypter(registry.getProject().getSecureStorage().getLocalSecretKey());
binaryContents = encrypter.encrypt(contents);
} else {
binaryContents = contents.getBytes(StandardCharsets.UTF_8);
}
// Save result to file
IOUtils.writeFileFromBuffer(configFile, binaryContents);
} catch (Exception e) {
log.error("Error saving configuration file " + configFile.getAbsolutePath(), e);
}
}
Aggregations