Skip to content

Commit

Permalink
Merge pull request #119 from cconlon/certchainalias
Browse files Browse the repository at this point in the history
X509KeyManager.getCertificateChain(): return null if alias is null
  • Loading branch information
JacobBarthelmeh authored Mar 7, 2023
2 parents 3420a39 + dd7974a commit e405d6d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/java/com/wolfssl/provider/jsse/WolfSSLKeyX509.java
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ public X509Certificate[] getCertificateChain(String alias) {
WolfSSLDebug.log(getClass(), WolfSSLDebug.INFO,
"entered getCertificateChain(), alias: " + alias);

if (store == null) {
if (store == null || alias == null) {
return null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,15 @@ public void testgetClientAliases() {
fail("unexpected number of alias found");
}

/* Try getting chain with null alias, should return null */
chain = km.getCertificateChain(null);
if (chain != null) {
error("\t... failed");
fail("did not return null chain with null alias");
return;
}

/* Try getting chain with client alias */
chain = km.getCertificateChain("client");
if (chain == null || chain.length < 1) {
error("\t... failed");
Expand Down

0 comments on commit e405d6d

Please sign in to comment.