feat: Actually encrypt private keys on disk and in DB #16

Merged
MarkL4YG merged 10 commits from feat/pkeyEncryption into main 2024-11-23 16:58:55 +00:00
Showing only changes of commit d801e151ad - Show all commits

View file

@ -41,12 +41,20 @@ public class OpenSSLCertificateResult implements CertificateUsage {
@Override @Override
public void close() { public void close() {
cleanupDir(true);
}
private void cleanupDir(boolean retryOnExit) {
try { try {
log.info("Cleaning up temporary output directory {}", tmpDir); log.info("Cleaning up temporary output directory {}", tmpDir);
Files.walkFileTree(tmpDir, Set.of(), Integer.MAX_VALUE, new DeleteRecursiveFileVisitor()); Files.walkFileTree(tmpDir, Set.of(), Integer.MAX_VALUE, new DeleteRecursiveFileVisitor());
Files.deleteIfExists(tmpDir); Files.deleteIfExists(tmpDir);
} catch (IOException e) { } catch (IOException e) {
log.error("Failed to clean up temporary output directory {}!", tmpDir, e); log.error("Failed to clean up temporary output directory {}! (retry={})", tmpDir, retryOnExit, e);
if (retryOnExit) {
Runtime.getRuntime().addShutdownHook(new Thread(() -> cleanupDir(false)));
}
} }
} }
} }