From b982d65ec1276f5387604cf2ecd014ff52775486 Mon Sep 17 00:00:00 2001 From: Michael Dombrowski Date: Tue, 25 Jul 2023 19:16:36 -0400 Subject: [PATCH] fix: move pkcs11 initialization into plugin startup instead of install (#37) --- .../security/provider/pkcs11/PKCS11CryptoKeyService.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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);