]> WPIA git - gigi.git/blobdiff - src/org/cacert/gigi/util/PEM.java
fix: more leasurely decode pem (ignore whitespace)
[gigi.git] / src / org / cacert / gigi / util / PEM.java
index 049822c1b5eabcb306624e86e816101812bce446..3be46531dc93bf9d26740399c6e3aa311a47a2ce 100644 (file)
@@ -14,9 +14,10 @@ public class PEM {
     }
 
     public static byte[] decode(String type, String data) {
-        data = data.replaceAll("-----BEGIN " + type + "-----", "").replace("\n", "").replace("\r", "");
+        data = data.replaceAll("-----BEGIN " + type + "-----", "");
         // Remove the first and last lines
         data = data.replaceAll("-----END " + type + "-----", "");
+        data = data.replace("\n", "").replace("\r", "").replace(" ", "").replace("\t", "");
         // Base64 decode the data
         return Base64.getDecoder().decode(data);