Fix upgrading from a build prior to cert pinning support

This commit is contained in:
Cameron Gutman 2019-07-16 20:08:41 -07:00
parent a1c659b7b8
commit dc97adc7a1
2 changed files with 12 additions and 9 deletions

View File

@ -7,8 +7,8 @@ android {
minSdkVersion 16
targetSdkVersion 29
versionName "7.4"
versionCode = 195
versionName "8.0"
versionCode = 196
}
flavorDimensions "root"

View File

@ -28,15 +28,18 @@ public class LegacyDatabaseReader2 {
details.manualAddress = c.getString(4);
details.macAddress = c.getString(5);
try {
byte[] derCertData = c.getBlob(6);
// This column wasn't always present in the old schema
if (c.getColumnCount() >= 7) {
try {
byte[] derCertData = c.getBlob(6);
if (derCertData != null) {
details.serverCert = (X509Certificate) CertificateFactory.getInstance("X.509")
.generateCertificate(new ByteArrayInputStream(derCertData));
if (derCertData != null) {
details.serverCert = (X509Certificate) CertificateFactory.getInstance("X.509")
.generateCertificate(new ByteArrayInputStream(derCertData));
}
} catch (CertificateException e) {
e.printStackTrace();
}
} catch (CertificateException e) {
e.printStackTrace();
}
// This signifies we don't have dynamic state (like pair state)