summaryrefslogtreecommitdiff
path: root/smcc/src/main/java/at/gv/egiz
diff options
context:
space:
mode:
Diffstat (limited to 'smcc/src/main/java/at/gv/egiz')
-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
3 files changed, 33 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.