From 92982d1ee7f13e5206ea192776b0a042d2ddea2f Mon Sep 17 00:00:00 2001 From: Thomas Lenz Date: Tue, 12 Jun 2018 12:08:12 +0200 Subject: fix wrong encoding in EncryptedBPKAttributeBuilder --- .../egovernment/moa/id/auth/builder/BPKBuilder.java | 3 ++- .../attributes/EncryptedBPKAttributeBuilder.java | 19 +++++++++++++------ 2 files changed, 15 insertions(+), 7 deletions(-) (limited to 'id/server/idserverlib/src/main/java/at/gv') diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/BPKBuilder.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/BPKBuilder.java index 14de65e36..865f7e6b4 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/BPKBuilder.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/auth/builder/BPKBuilder.java @@ -171,7 +171,8 @@ public class BPKBuilder { try { byte[] inputBytes = input.getBytes("ISO-8859-1"); result = encrypt(inputBytes, publicKey); - return new String(Base64Utils.encode(result, "ISO-8859-1")).replaceAll("\r\n", ""); + + return new String(java.util.Base64.getEncoder().encode(result), "ISO-8859-1").replaceAll("\r\n", ""); } catch (Exception e) { throw new BuildException("bPK encryption FAILED", null, e); diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/builder/attributes/EncryptedBPKAttributeBuilder.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/builder/attributes/EncryptedBPKAttributeBuilder.java index f5c48b826..d15f545ae 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/builder/attributes/EncryptedBPKAttributeBuilder.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/builder/attributes/EncryptedBPKAttributeBuilder.java @@ -23,12 +23,9 @@ package at.gv.egovernment.moa.id.protocols.builder.attributes; import at.gv.egovernment.moa.id.commons.api.IOAAuthParameters; -import at.gv.egovernment.moa.id.config.auth.OAAuthParameter; import at.gv.egovernment.moa.id.data.IAuthData; import at.gv.egovernment.moa.id.protocols.pvp2x.builder.attributes.exceptions.AttributeException; import at.gv.egovernment.moa.id.protocols.pvp2x.builder.attributes.exceptions.UnavailableAttributeException; -import at.gv.egovernment.moa.logging.Logger; -import at.gv.egovernment.moa.util.Constants; public class EncryptedBPKAttributeBuilder implements IPVPAttributeBuilder { @@ -40,10 +37,10 @@ public class EncryptedBPKAttributeBuilder implements IPVPAttributeBuilder { IAttributeGenerator g) throws AttributeException { if (authData.getEncbPKList() != null && - authData.getEncbPKList().size() > 0) { - String value = "(" + authData.getEncbPKList().get(0) + ")"; + authData.getEncbPKList().size() > 0) { + String value = addPreAndSufix(authData.getEncbPKList().get(0)); for (int i=1; i