From db52e4d66d60184d53a27ba4d6772461daacc03d Mon Sep 17 00:00:00 2001 From: tknall Date: Fri, 22 Mar 2013 08:57:51 +0000 Subject: Maintenance update (bugfixes, new features, cleanup...) Refer to /dok/RELEASE_NOTES-3.3.txt for further information. git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/pdf-as/trunk@931 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c --- .../at/knowcenter/wag/egov/egiz/sig/X509Cert.java | 32 ++++++++++++++-------- 1 file changed, 20 insertions(+), 12 deletions(-) (limited to 'pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/sig/X509Cert.java') diff --git a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/sig/X509Cert.java b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/sig/X509Cert.java index 7b4e463..e11a38c 100644 --- a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/sig/X509Cert.java +++ b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/sig/X509Cert.java @@ -99,7 +99,7 @@ public class X509Cert implements Serializable * statement and remove all whitespaces in the string. The result string * (base64) is used by reconstructing the certiface sign by the verification * process. - * + * * @param certString * the string to normalize * @return the normalized cert string @@ -115,7 +115,7 @@ public class X509Cert implements Serializable /** * This method initialzes a X509Certificate by a string value. It must be * coded Base64 or as plain binary stream. - * + * * @param certString * the certificate string to analyse * @return the X509Cert object @@ -150,7 +150,9 @@ public class X509Cert implements Serializable String serial_num = cert.getSerialNumber().toString(); String issuer = cert.getIssuerDN().getName(); - issuer = issuer.replaceAll(", ", ","); + // fixed by dti: commas within issuer rdns are escapted by "\,". These escapted commas must not be replaced. +// issuer = issuer.replaceAll(", ", ","); + issuer = issuer.replaceAll("[^\\\\], ", ","); String subject_name = cert.getSubjectDN().toString(); x509_cert.setSerialNumber(serial_num); x509_cert.setIssuerName(issuer); @@ -174,7 +176,7 @@ public class X509Cert implements Serializable } return x509_cert; } - + public static X509Cert initByX509Certificate(X509Certificate cert) throws CertificateEncodingException { X509Cert x509_cert = new X509Cert(); x509_cert.setX509Cert(cert); @@ -182,7 +184,9 @@ public class X509Cert implements Serializable String serial_num = cert.getSerialNumber().toString(); String issuer = cert.getIssuerDN().getName(); - issuer = issuer.replaceAll(", ", ","); + // fixed by dti: commas within issuer rdns are escapted by "\,". These escapted commas must not be replaced. +// issuer = issuer.replaceAll(", ", ","); + issuer = issuer.replaceAll("[^\\\\], ", ","); String subject_name = cert.getSubjectDN().toString(); x509_cert.setSerialNumber(serial_num); x509_cert.setIssuerName(issuer); @@ -210,7 +214,9 @@ public class X509Cert implements Serializable String serial_num = cert.getSerialNumber().toString(); String issuer = cert.getIssuerDN().getName(); - issuer = issuer.replaceAll(", ", ","); + // fixed by dti: commas within issuer rdns are escapted by "\,". These escapted commas must not be replaced. +// issuer = issuer.replaceAll(", ", ","); + issuer = issuer.replaceAll("[^\\\\], ", ","); String subject_name = cert.getSubjectDN().toString(); x509_cert.setSerialNumber(serial_num); x509_cert.setIssuerName(issuer); @@ -226,7 +232,7 @@ public class X509Cert implements Serializable { // nothing to do, cause certString is not X509 conformc logger_.error(ce.getMessage(), ce); - + } catch (IOException ioe) { @@ -240,7 +246,7 @@ public class X509Cert implements Serializable /** * This method initialzes a X509Certificate by a file path value. The file * must be a plain binary file like .cer format. - * + * * @param filePath * the certificate file to analyse * @return the X509Cert object @@ -276,7 +282,9 @@ public class X509Cert implements Serializable String serial_num = cert.getSerialNumber().toString(); String issuer = cert.getIssuerDN().getName(); - issuer = issuer.replaceAll(", ", ","); + // fixed by dti: commas within issuer rdns are escapted by "\,". These escapted commas must not be replaced. +// issuer = issuer.replaceAll(", ", ","); + issuer = issuer.replaceAll("[^\\\\], ", ","); String subject_name = cert.getSubjectDN().toString(); x509_cert.setSerialNumber(serial_num); x509_cert.setIssuerName(issuer); @@ -300,7 +308,7 @@ public class X509Cert implements Serializable /** * This method initialzes a X509Certificate by a file value. The file must be * a plain binary file like .cer format. - * + * * @param certFile * the certificate file to analyse * @return the X509Cert object @@ -314,7 +322,7 @@ public class X509Cert implements Serializable /** * This method checks if a certificate file is X509 conform. - * + * * @return true if a certificate file is X509 conform, false otherwise */ public boolean isX509Cert() @@ -480,7 +488,7 @@ public class X509Cert implements Serializable /** * This method checks, if a X509Certificate has a public key with the rsa * algorithm. - * + * * @return true if the public key is produced with rsa, false otherwise */ public boolean isRSA() -- cgit v1.2.3