Crypto: Catch IAE in generateCertificate()

This commit is contained in:
zzz
2015-02-01 19:47:09 +00:00
parent 1042d21278
commit b6008b5414
3 changed files with 14 additions and 0 deletions

View File

@@ -61,6 +61,9 @@ class DirKeyRing implements KeyRing {
throw new GeneralSecurityException("CN mismatch: " + cn);
}
return cert.getPublicKey();
} catch (IllegalArgumentException iae) {
// java 1.8.0_40-b10, openSUSE
throw new GeneralSecurityException("Bad cert", iae);
} finally {
try { if (fis != null) fis.close(); } catch (IOException foo) {}
}

View File

@@ -248,6 +248,12 @@ public class KeyStoreUtil {
} catch (IOException ioe) {
error("Error reading X509 Certificate: " + file.getAbsolutePath(), ioe);
return false;
} catch (IllegalArgumentException iae) {
// java 1.8.0_40-b10, openSUSE
// Exception in thread "main" java.lang.IllegalArgumentException: Input byte array has wrong 4-byte ending unit
// at java.util.Base64$Decoder.decode0(Base64.java:704)
error("Error reading X509 Certificate: " + file.getAbsolutePath(), iae);
return false;
} finally {
try { if (fis != null) fis.close(); } catch (IOException foo) {}
}

View File

@@ -980,6 +980,11 @@ public class SU3File {
IOException ioe = new IOException("cert error");
ioe.initCause(gse);
throw ioe;
} catch (IllegalArgumentException iae) {
// java 1.8.0_40-b10, openSUSE
IOException ioe = new IOException("cert error");
ioe.initCause(iae);
throw ioe;
} finally {
try { if (fis != null) fis.close(); } catch (IOException foo) {}
}