From 34c964709547ef67085d29e4d4b9692551be5140 Mon Sep 17 00:00:00 2001 From: Thomas Lenz Date: Fri, 4 Dec 2015 21:19:53 +0100 Subject: check if PVP SigningCredentials contains a privatekey after load keystore load operation --- .../moa/id/protocols/pvp2x/signer/CredentialProvider.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/signer/CredentialProvider.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/signer/CredentialProvider.java index fe287a433..645eb9e53 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/signer/CredentialProvider.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/signer/CredentialProvider.java @@ -59,6 +59,12 @@ public class CredentialProvider { .getIDPKeyPasswordMetadata().toCharArray()); credentials.setUsageType(UsageType.SIGNING); + if (credentials.getPrivateKey() == null && credentials.getSecretKey() == null) { + Logger.error("IDP Metadata Signing credentials is not found or contains no PrivateKey."); + throw new CredentialsNotAvailableException("IDP Assertion Signing credentials (Alias: " + + config.getIDPKeyAliasMetadata() + ") is not found or contains no PrivateKey.", null); + + } return credentials; } catch (Exception e) { Logger.error("Failed to generate IDP Metadata Signing credentials"); -- cgit v1.2.3