Добавлено общее хранилище ключей

This commit is contained in:
serega6531
2020-04-24 00:08:13 +03:00
parent 200dde7940
commit 441e210ea7
4 changed files with 24 additions and 2 deletions

View File

@@ -1,5 +1,7 @@
package ru.serega6531.packmate.service.optimization;
import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Service;
import ru.serega6531.packmate.utils.TlsUtils;
@@ -23,7 +25,6 @@ public class RsaKeysHolder {
X509KeyManager keyManager = TlsUtils.createKeyManager(pemFile, keyFile);
// X509Certificate[] certificateChain = keyManager.getCertificateChain("1");
RSAPrivateKey privateKey = ((RSAPrivateKey) keyManager.getPrivateKey("1"));
keys.put(privateKey.getModulus(), privateKey);
}
@@ -32,4 +33,9 @@ public class RsaKeysHolder {
return keys.get(modulus);
}
@EventListener(ApplicationReadyEvent.class)
public void afterStartup(ApplicationReadyEvent event) {
//TODO load keys
}
}