From 6e421407cbd61a63f0f65e27929f28125546cbc1 Mon Sep 17 00:00:00 2001 From: Thomas Lenz Date: Fri, 4 Dec 2015 21:20:55 +0100 Subject: add additional PVP credential checks --- .../moa/id/protocols/pvp2x/signer/CredentialProvider.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'id/server') 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 645eb9e53..d76e6c2f1 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 @@ -86,6 +86,13 @@ public class CredentialProvider { .getIDPKeyPasswordAssertionSign().toCharArray()); credentials.setUsageType(UsageType.SIGNING); + if (credentials.getPrivateKey() == null && credentials.getSecretKey() == null) { + Logger.error("IDP Assertion Signing credentials is not found or contains no PrivateKey."); + throw new CredentialsNotAvailableException("IDP Assertion Signing credentials (Alias: " + + config.getIDPKeyAliasAssertionSign() + ") is not found or contains no PrivateKey.", null); + + } + return (X509Credential) credentials; } catch (Exception e) { Logger.error("Failed to generate IDP Assertion Signing credentials"); @@ -111,6 +118,14 @@ public class CredentialProvider { .getIDPKeyPasswordAssertionEncryption().toCharArray()); credentials.setUsageType(UsageType.ENCRYPTION); + + if (credentials.getPrivateKey() == null && credentials.getSecretKey() == null) { + Logger.error("IDP Assertion Encryption credentials is not found or contains no PrivateKey."); + throw new CredentialsNotAvailableException("IDP Assertion Encryption credentials (Alias: " + + config.getIDPKeyAliasAssertionEncryption() + ") is not found or contains no PrivateKey.", null); + + } + return (X509Credential) credentials; } catch (Exception e) { Logger.error("Failed to generate IDP Assertion Encryption credentials"); -- cgit v1.2.3