diff options
Diffstat (limited to 'src/main/java/at')
-rw-r--r-- | src/main/java/at/gv/egiz/pdfas/impl/signator/binary/BinarySignator_1_0_0.java | 60 |
1 files changed, 53 insertions, 7 deletions
diff --git a/src/main/java/at/gv/egiz/pdfas/impl/signator/binary/BinarySignator_1_0_0.java b/src/main/java/at/gv/egiz/pdfas/impl/signator/binary/BinarySignator_1_0_0.java index 5766b89..46e46cb 100644 --- a/src/main/java/at/gv/egiz/pdfas/impl/signator/binary/BinarySignator_1_0_0.java +++ b/src/main/java/at/gv/egiz/pdfas/impl/signator/binary/BinarySignator_1_0_0.java @@ -301,12 +301,11 @@ public class BinarySignator_1_0_0 implements Signator {
throw new SignatorException(e);
}
-
+
BinarySignature.replaceCertificate(iui);
BinarySignature.replaceTimestamp(iui);
BinarySignature.replacePlaceholders(iui);
-
-// dferbas: alternative sign attrib creation
+ // dferbas: alternative sign attrib creation
// PdfReader reader = new PdfReader(iui.signed_pdf);
//
// OutputStream os = dataSink.createOutputStream(PdfAS.PDF_MIME_TYPE);
@@ -358,14 +357,61 @@ public class BinarySignator_1_0_0 implements Signator ReplaceInfo ri = (ReplaceInfo) it.next();
String overrideVal = OverridePropertyHolder.getProperty(ri.sfd.field_name);
if (overrideVal != null) {
- ri.sfd.value = overrideVal;
+ ri.sfd.value = overrideVal;
ri.value = overrideVal;
} else if (ognl.containsExpression(ri.sfd.value)) { // dferbas
// evaluate expression
String res = ognl.compileMessage(ri.sfd.value);
-
- ri.value = this.normalizer.normalize(res, true);
-
+ ri.value = this.normalizer.normalize(res, true);
+ //Workaround added by rpiazzi
+ //a-trust wrongly encodes since July 2011, therefore some special characters (e.g. Umlaute) have
+ //to replaced by their right character
+ if ((ri.value.contains("ü") || ri.value.contains("ä") || ri.value.contains("ö") ||
+ ri.value.contains("á") || ri.value.contains("ß") || ri.value.contains("Ö") ||
+ ri.value.contains("à") || ri.value.contains("é") || ri.value.contains("ú") ||
+ ri.value.contains("ç")) && (ri.sfd.field_name.equals(SignatureTypes.SIG_SUBJECT))) {
+ if (ri.value.contains("ü")) {
+ ri.sfd.value = ri.sfd.value.replace("ü", "ü");
+ ri.value = ri.value.replace("ü", "ü");
+ }
+ if (ri.value.contains("ä")) {
+ ri.sfd.value = ri.sfd.value.replace("ä", "ä");
+ ri.value = ri.value.replace("ä", "ä");
+ }
+ if (ri.value.contains("ö")) {
+ ri.sfd.value = ri.sfd.value.replace("ö", "ö");
+ ri.value = ri.value.replace("ö", "ö");
+ }
+ if (ri.value.contains("á")) {
+ ri.sfd.value = ri.sfd.value.replace("á", "á");
+ ri.value = ri.value.replace("á", "á");
+ }
+ if (ri.value.contains("ß")) {
+ ri.sfd.value = ri.sfd.value.replace("ß", "ß");
+ ri.value = ri.value.replace("ß", "ß");
+ }
+ if (ri.value.contains("Ö")) {
+ ri.sfd.value = ri.sfd.value.replace("Ö", "Ö");
+ ri.value = ri.value.replace("Ö", "Ö");
+ }
+ if (ri.value.contains("à")) {
+ ri.sfd.value = ri.sfd.value.replace("à", "à");
+ ri.value = ri.value.replace("à", "à");
+ }
+ if (ri.value.contains("é")) {
+ ri.sfd.value = ri.sfd.value.replace("é", "é");
+ ri.value = ri.value.replace("é", "é");
+ }
+ if (ri.value.contains("ú")) {
+ ri.sfd.value = ri.sfd.value.replace("ú", "ú");
+ ri.value = ri.value.replace("ú", "ú");
+ }
+ if (ri.value.contains("ç")) {
+ ri.sfd.value = ri.sfd.value.replace("ç", "ç");
+ ri.value = ri.value.replace("ç", "ç");
+ }
+ }
+ //end added
} else if (overrideVal == null) {
//If SUBJECT is not overridden and and also isn't an expression
//check whether a set value for subject exists.
|