Skip to content

Commit

Permalink
Check for null cert, comments
Browse files Browse the repository at this point in the history
  • Loading branch information
kpanchen committed Aug 19, 2022
1 parent 68dfa29 commit d09037a
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ private KeyStore makeJavaKeyStore(X509Certificate trustedCert) {

byte[] bytes = ((X509Certificate) certs[0]).getEncoded();
if (bytes.length != 0) {
// Certificate obtained successfully
return BEGIN_CERT + "\r\n" + Base64.getEncoder().encodeToString(bytes) + "\r\n" + END_CERT;
}
} catch (NoSuchAlgorithmException | KeyManagementException | IOException e) {
Expand All @@ -171,6 +172,7 @@ private KeyStore makeJavaKeyStore(X509Certificate trustedCert) {
connection.disconnect();
}
}
// Failed to obtain certificate
return null;
}
}

0 comments on commit d09037a

Please sign in to comment.