Skip to content

Commit

Permalink
Add handling for possible empty content for PemObject
Browse files Browse the repository at this point in the history
Signed-off-by: Arthur Chan <arthur.chan@adalogics.com>
  • Loading branch information
arthurscchan committed Mar 22, 2023
1 parent 839d113 commit 59433f7
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public static PublicKey parsePublicKey(byte[] keyBytes)
throw new InvalidKeySpecException("Invalid key, could not parse PEM section");
}
// special handling for PKCS1 (rsa) public key
if (section == null) {
if ((section == null) || (section.getContent() == null)) {
throw new InvalidKeySpecException("Invalid key");
}
if (section.getType().equals("RSA PUBLIC KEY")) {
Expand Down

0 comments on commit 59433f7

Please sign in to comment.