summaryrefslogtreecommitdiff
path: root/src/main/java/at/gv/util
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at/gv/util')
-rw-r--r--src/main/java/at/gv/util/BpkUtil.java34
-rw-r--r--src/main/java/at/gv/util/client/ur_V5/URClient.java15
2 files changed, 41 insertions, 8 deletions
diff --git a/src/main/java/at/gv/util/BpkUtil.java b/src/main/java/at/gv/util/BpkUtil.java
index 5c256c4..31dfa6d 100644
--- a/src/main/java/at/gv/util/BpkUtil.java
+++ b/src/main/java/at/gv/util/BpkUtil.java
@@ -53,7 +53,10 @@ public final class BpkUtil {
public static final String SECTOR_DELIVERY = "ZU";
public static final String PUBLIC_KEY_ZUSEKOPF_SN01_BASE64 = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDfGFFEzWl1kSbzmk4pWVeftyD2aWTVQ8xSIwb6ECLdFTy4zE9LI6a87zlPbOOzvvdO+Nv1VCvT+WqD9HOCtPwealwwRKS2cHI9aqYyozqDOIGBRIz7MDBKuqaTwCvonFe0MUBxVWDDTmqhDIjkN0uDQidQtqqjzupEzuQ59lVpBQIDAQAB";
- public static final String prefix = "urn:publicid:gv.at:cdid+";
+ public static final String PREFIX_BPK_TYPE = "urn:publicid:gv.at:cdid+";
+ public static final String PREFIX_WBPK_TYPE = "urn:publicid:gv.at:wbpk+";
+ public static final String PREFIX_STORK_TYPE = "urn:publicid:gv.at:storkid+";
+
private static String calcDigest(String data)
@@ -64,19 +67,36 @@ public final class BpkUtil {
}
+ public static String calcbPKorwbPKorSTORKID(String baseID, String sector) {
+ MiscUtil.assertNotEmpty(baseID, "BaseID");
+ MiscUtil.assertNotEmpty(sector, "Sector");
+
+ if (sector.startsWith(PREFIX_BPK_TYPE))
+ return calcBPK(baseID, sector);
+
+ else if (sector.startsWith(PREFIX_WBPK_TYPE))
+ return calcWBPK(baseID, sector);
+
+ else if (sector.startsWith(PREFIX_STORK_TYPE))
+ return calcWBPK(baseID, sector);
+
+ else
+ throw new InternalErrorException("Sector is not of bPK or wbPK or stork type");
+
+ }
+
public static String calcBPK(String baseID, String sector) {
MiscUtil.assertNotEmpty(baseID, "BaseID");
MiscUtil.assertNotEmpty(sector, "Sector");
// prefix according to specification
- String prefix = "urn:publicid:gv.at:cdid+";
-
+
// concatenation according to algorithm
String data;
- if (sector.startsWith(prefix))
+ if (sector.startsWith(PREFIX_BPK_TYPE))
data = baseID + "+" + sector;
else
- data = baseID + "+" + prefix + sector;
+ data = baseID + "+" + PREFIX_BPK_TYPE + sector;
String hash = null;
try {
@@ -91,8 +111,8 @@ public final class BpkUtil {
public static BPK createBPK(String baseID, String sector) {
- if (sector.startsWith(prefix))
- sector = sector.substring(prefix.length());
+ if (sector.startsWith(PREFIX_BPK_TYPE))
+ sector = sector.substring(PREFIX_BPK_TYPE.length());
return new BPK(sector, calcBPK(baseID, sector));
}
diff --git a/src/main/java/at/gv/util/client/ur_V5/URClient.java b/src/main/java/at/gv/util/client/ur_V5/URClient.java
index d54e771..f391c32 100644
--- a/src/main/java/at/gv/util/client/ur_V5/URClient.java
+++ b/src/main/java/at/gv/util/client/ur_V5/URClient.java
@@ -237,7 +237,20 @@ public class URClient {
if (this.allowedERsBKeys.contains(String.valueOf(funct.getFktName()))) {
List<FktRegelTypVollzug> functRegel = funct.getFktRegel();
for (FktRegelTypVollzug el : functRegel) {
- if ( (el.getFktRegelVon().compare(xmldate) == DatatypeConstants.LESSER
+ if ( el.getFktRegelVon() == null && el.getFktRegelBis() == null)
+ set.add(String.valueOf(funct.getFktName()));
+
+ else if ( el.getFktRegelVon() != null && el.getFktRegelBis() == null
+ && el.getFktRegelVon().compare(xmldate) == DatatypeConstants.LESSER )
+ set.add(String.valueOf(funct.getFktName()));
+
+ else if ( el.getFktRegelVon() == null && el.getFktRegelBis() != null
+ && el.getFktRegelBis().compare(xmldate) == DatatypeConstants.GREATER )
+ set.add(String.valueOf(funct.getFktName()));
+
+
+ else if ( el.getFktRegelVon() != null && el.getFktRegelBis() != null
+ && (el.getFktRegelVon().compare(xmldate) == DatatypeConstants.LESSER
&& el.getFktRegelBis().compare(xmldate) == DatatypeConstants.GREATER) )
set.add(String.valueOf(funct.getFktName()));