From b16cc99a8533a65b2bf8764a2f017a5882eed0cd Mon Sep 17 00:00:00 2001 From: Thomas <> Date: Fri, 19 Feb 2021 16:48:53 +0100 Subject: fix wrong bPK calculation for XZVR and XERSB bpkTargets --- .../core/impl/idp/auth/builder/BpkBuilder.java | 36 +++++++++++++++++++--- .../attributes/EidSectorForIdAttributeBuilder.java | 2 +- 2 files changed, 32 insertions(+), 6 deletions(-) (limited to 'eaaf_core/src/main/java/at/gv') diff --git a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/builder/BpkBuilder.java b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/builder/BpkBuilder.java index 8e827303..17d0099e 100644 --- a/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/builder/BpkBuilder.java +++ b/eaaf_core/src/main/java/at/gv/egiz/eaaf/core/impl/idp/auth/builder/BpkBuilder.java @@ -116,9 +116,10 @@ public class BpkBuilder { } else if (targetIdentifier.startsWith(EaafConstants.URN_PREFIX_WBPK)) { log.trace("Calculate wbPK identifier for target: " + targetIdentifier); + String commonBpkTarget = normalizeBpkTargetIdentifierToCommonFormat(targetIdentifier); return Pair.newInstance(calculatebPKwbPK( - baseID + "+" + normalizeBpkTargetIdentifierToCalculationFormat(targetIdentifier)), - normalizeBpkTargetIdentifierToCommonFormat(targetIdentifier)); + baseID + "+" + normalizeBpkTargetIdentifierToBpkCalculationFormat(commonBpkTarget)), + commonBpkTarget); } else if (targetIdentifier.startsWith(EaafConstants.URN_PREFIX_EIDAS)) { log.trace("Calculate eIDAS identifier for target: " + targetIdentifier); @@ -179,7 +180,8 @@ public class BpkBuilder { } - target = normalizeBpkTargetIdentifierToCalculationFormat(target); + target = normalizeBpkTargetIdentifierToBpkCalculationFormat( + normalizeBpkTargetIdentifierToCommonFormat(target)); final String input = "V1::" + target + "::" + bpk + "::" + sdf.format(new Date()); @@ -274,7 +276,7 @@ public class BpkBuilder { } /** - * Normalize wbPK target identifier for XFN, XZVR, and XERSB to bPK calculation format like, FN, ZVR, and ERSB. + * Normalize wbPK target identifier for XFN, XZVR, and XERSB to bPK non-X format like, FN, ZVR, and ERSB. * *
If the target is not of this types the target will be returned as it is
* @@ -282,7 +284,7 @@ public class BpkBuilder { * @return FN, ZVR, ERSB, or targetIdentfier if no normalization is required */ @Nullable - public static String normalizeBpkTargetIdentifierToCalculationFormat(@Nullable String targetIdentifier) { + public static String normalizeBpkTargetIdentifierToNonXFormat(@Nullable String targetIdentifier) { if (targetIdentifier != null && targetIdentifier.startsWith(EaafConstants.URN_PREFIX_WBPK)) { for (EntryIf the target is not of this types the target will be returned as it is
+ * + * @param targetIdentifier bPK input target + * @return FN, VR, ERJ, or targetIdentfier if no normalization is required + */ + @Nullable + public static String normalizeBpkTargetIdentifierToBpkCalculationFormat(@Nullable String targetIdentifier) { + if (targetIdentifier != null && targetIdentifier.startsWith(EaafConstants.URN_PREFIX_WBPK)) { + for (Entry