android: Catch NullPointerException when parsing invalid certificates
This commit is contained in:
+9
@@ -43,6 +43,8 @@ public class TrustedCertificateEntry implements Comparable<TrustedCertificateEnt
|
||||
mCert = cert;
|
||||
mAlias = alias;
|
||||
|
||||
try
|
||||
{
|
||||
SslCertificate ssl = new SslCertificate(mCert);
|
||||
String o = ssl.getIssuedTo().getOName();
|
||||
String ou = ssl.getIssuedTo().getUName();
|
||||
@@ -68,6 +70,13 @@ public class TrustedCertificateEntry implements Comparable<TrustedCertificateEnt
|
||||
mSubjectPrimary = ssl.getIssuedTo().getDName();
|
||||
}
|
||||
}
|
||||
catch (NullPointerException ex)
|
||||
{
|
||||
/* this has been seen in Play Console for certificates for which notBefore apparently
|
||||
* can't be parsed (which SslCertificate() does) */
|
||||
mSubjectPrimary = cert.getSubjectDN().getName();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The main subject of this certificate (O, CN or the complete DN, whatever
|
||||
|
||||
Reference in New Issue
Block a user