diff --git a/src/main/java/com/aws/greengrass/security/provider/pkcs11/PKCS11CryptoKeyService.java b/src/main/java/com/aws/greengrass/security/provider/pkcs11/PKCS11CryptoKeyService.java index 43b4089..7a8bff6 100644 --- a/src/main/java/com/aws/greengrass/security/provider/pkcs11/PKCS11CryptoKeyService.java +++ b/src/main/java/com/aws/greengrass/security/provider/pkcs11/PKCS11CryptoKeyService.java @@ -167,13 +167,14 @@ protected void install() throws InterruptedException { throw new RuntimeException(String.format("Failed to install PKCS11CryptoKeyService. " + "Make sure that configuration format for %s service is valid.", PKCS11_SERVICE_NAME)); } - if (!initializePkcs11Lib() || !initializePkcs11Provider()) { - serviceErrored("Can't initialize PKCS11"); - } } @Override protected void startup() throws InterruptedException { + if (!initializePkcs11Lib() || !initializePkcs11Provider()) { + serviceErrored("Can't initialize PKCS11"); + return; + } try { securityService.registerCryptoKeyProvider(this); securityService.registerMqttConnectionProvider(this);