summaryrefslogtreecommitdiff
path: root/smcc/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'smcc/src/main')
-rw-r--r--smcc/src/main/java/at/gv/egiz/smcc/ACOSCard.java6
-rw-r--r--smcc/src/main/java/at/gv/egiz/smcc/PINSpec.java36
-rw-r--r--smcc/src/main/java/at/gv/egiz/smcc/STARCOSCard.java4
-rw-r--r--smcc/src/main/resources/at/gv/egiz/smcc/ACOSCard.properties3
-rw-r--r--smcc/src/main/resources/at/gv/egiz/smcc/STARCOSCard.properties2
5 files changed, 38 insertions, 13 deletions
diff --git a/smcc/src/main/java/at/gv/egiz/smcc/ACOSCard.java b/smcc/src/main/java/at/gv/egiz/smcc/ACOSCard.java
index 99aadebd..414d4678 100644
--- a/smcc/src/main/java/at/gv/egiz/smcc/ACOSCard.java
+++ b/smcc/src/main/java/at/gv/egiz/smcc/ACOSCard.java
@@ -104,13 +104,13 @@ public class ACOSCard extends AbstractSignatureCard implements PINMgmtSignatureC
};
private static final PINSpec DEC_PIN_SPEC = new PINSpec(0, 8, "[0-9]",
- "at/gv/egiz/smcc/ACOSCard", "dec.pin.name", KID_PIN_DEC, AID_DEC);
+ "at/gv/egiz/smcc/ACOSCard", "dec.pin", KID_PIN_DEC, AID_DEC);
private static final PINSpec SIG_PIN_SPEC = new PINSpec(0, 8, "[0-9]",
- "at/gv/egiz/smcc/ACOSCard", "sig.pin.name", KID_PIN_SIG, AID_SIG);
+ "at/gv/egiz/smcc/ACOSCard", "sig.pin", KID_PIN_SIG, AID_SIG);
private static final PINSpec INF_PIN_SPEC = new PINSpec(0, 8, "[0-9]",
- "at/gv/egiz/smcc/ACOSCard", "inf.pin.name", KID_PIN_INF, AID_DEC);
+ "at/gv/egiz/smcc/ACOSCard", "inf.pin", KID_PIN_INF, AID_DEC);
/**
* The version of the card's digital signature application.
diff --git a/smcc/src/main/java/at/gv/egiz/smcc/PINSpec.java b/smcc/src/main/java/at/gv/egiz/smcc/PINSpec.java
index b8ffafab..1812049c 100644
--- a/smcc/src/main/java/at/gv/egiz/smcc/PINSpec.java
+++ b/smcc/src/main/java/at/gv/egiz/smcc/PINSpec.java
@@ -33,7 +33,10 @@ public class PINSpec {
String resourceBundleName_;
- String name_;
+ String nameKey_;
+
+ /** the localized, i.e. configurable length */
+ String lengthKey_;
byte kid_;
@@ -49,13 +52,14 @@ public class PINSpec {
* @param kid the keyId for this pin
*/
public PINSpec(int minLenght, int maxLength, String rexepPattern,
- String resourceBundleName, String name, byte kid, byte[] contextAID) {
+ String resourceBundleName, String resourceKey, byte kid, byte[] contextAID) {
minLength_ = minLenght;
maxLength_ = maxLength;
rexepPattern_ = rexepPattern;
resourceBundleName_ = resourceBundleName;
- name_ = name;
+ nameKey_ = resourceKey + ".name";
+ lengthKey_ = resourceKey + ".length";
kid_ = kid;
context_aid_ = contextAID;
}
@@ -66,7 +70,8 @@ public class PINSpec {
minLength_ = minLenght;
maxLength_ = maxLength;
rexepPattern_ = rexepPattern;
- name_ = name;
+ nameKey_ = name + ".name";
+ lengthKey_ = name + ".length";
kid_ = kid;
context_aid_ = contextAID;
}
@@ -75,9 +80,9 @@ public class PINSpec {
if (resourceBundleName_ != null) {
ResourceBundle resourceBundle = ResourceBundle.getBundle(resourceBundleName_);
- return resourceBundle.getString(name_);
+ return resourceBundle.getString(nameKey_);
} else {
- return name_;
+ return nameKey_;
}
}
@@ -86,13 +91,28 @@ public class PINSpec {
if (resourceBundleName_ != null) {
ResourceBundle resourceBundle = ResourceBundle.getBundle(resourceBundleName_, locale);
- return resourceBundle.getString(name_);
+ return resourceBundle.getString(nameKey_);
} else {
- return name_;
+ return nameKey_;
}
}
+ public String getLocalizedLength() {
+
+ if (resourceBundleName_ != null) {
+ ResourceBundle resourceBundle = ResourceBundle.getBundle(resourceBundleName_);
+ return resourceBundle.getString(lengthKey_);
+ } else {
+ if (maxLength_ > minLength_) {
+ return minLength_ + "-" + maxLength_;
+ } else {
+ return String.valueOf(minLength_);
+ }
+ }
+
+ }
+
public int getMaxLength() {
return maxLength_;
}
diff --git a/smcc/src/main/java/at/gv/egiz/smcc/STARCOSCard.java b/smcc/src/main/java/at/gv/egiz/smcc/STARCOSCard.java
index 921819ee..2e6dd5d6 100644
--- a/smcc/src/main/java/at/gv/egiz/smcc/STARCOSCard.java
+++ b/smcc/src/main/java/at/gv/egiz/smcc/STARCOSCard.java
@@ -150,11 +150,11 @@ public class STARCOSCard extends AbstractSignatureCard implements PINMgmtSignatu
private static final PINSpec CARD_PIN_SPEC =
new PINSpec(4, 12, "[0-9]",
- "at/gv/egiz/smcc/STARCOSCard", "card.pin.name", KID_PIN_CARD, null);
+ "at/gv/egiz/smcc/STARCOSCard", "card.pin", KID_PIN_CARD, null);
private static final PINSpec SS_PIN_SPEC =
new PINSpec(6, 12, "[0-9]",
- "at/gv/egiz/smcc/STARCOSCard", "sig.pin.name", KID_PIN_SS, AID_DF_SS);
+ "at/gv/egiz/smcc/STARCOSCard", "sig.pin", KID_PIN_SS, AID_DF_SS);
/**
* Creates an new instance.
diff --git a/smcc/src/main/resources/at/gv/egiz/smcc/ACOSCard.properties b/smcc/src/main/resources/at/gv/egiz/smcc/ACOSCard.properties
index d2bbe4f9..2e032d1b 100644
--- a/smcc/src/main/resources/at/gv/egiz/smcc/ACOSCard.properties
+++ b/smcc/src/main/resources/at/gv/egiz/smcc/ACOSCard.properties
@@ -17,5 +17,8 @@
# and open the template in the editor.
dec.pin.name=Geheimhaltungs-PIN
+dec.pin.length=4
sig.pin.name=Signatur-PIN
+sig.pin.length=6
inf.pin.name=Infobox-PIN
+inf.pin.length=4
diff --git a/smcc/src/main/resources/at/gv/egiz/smcc/STARCOSCard.properties b/smcc/src/main/resources/at/gv/egiz/smcc/STARCOSCard.properties
index 6fa5f0fa..ae91f265 100644
--- a/smcc/src/main/resources/at/gv/egiz/smcc/STARCOSCard.properties
+++ b/smcc/src/main/resources/at/gv/egiz/smcc/STARCOSCard.properties
@@ -17,4 +17,6 @@
# and open the template in the editor.
sig.pin.name=Signatur-PIN
+sig.pin.length=6
card.pin.name=Karten-PIN
+card.pin.length=4