Skip to content

Commit

Permalink
Update exception handling in PFX.verifyAuthSafes()
Browse files Browse the repository at this point in the history
Previously the PFX.verifyAuthSafes() discarded the original
exception and simply returned a generic error message which
was usually insufficient to determine the cause of the issue.

To help troubleshooting, the PFX.verifyAuthSafes() has been
modified to throw the exception so the original error message
and the stack trace are preserved.
  • Loading branch information
edewata committed Apr 4, 2024
1 parent a76c3fc commit af5b47e
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions base/src/main/java/org/mozilla/jss/pkcs12/PFX.java
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ private void setEncodedAuthSafes(byte[] encodedAuthSafes) {
* this PFX does not contain a MacData, returns false.
*/
public boolean verifyAuthSafes(Password password, StringBuffer reason)
throws NotInitializedException {
throws Exception {

try {
if (reason == null) {
Expand Down Expand Up @@ -164,17 +164,8 @@ public boolean verifyAuthSafes(Password password, StringBuffer reason)
return false;
}

} catch (java.security.DigestException e) {
reason.append("A DigestException occurred");
return false;

} catch (TokenException e) {
reason.append("A TokenException occurred");
return false;

} catch (CharConversionException e) {
reason.append("An exception occurred converting the password from chars to bytes");
return false;
} catch (Exception e) {
throw e;
}
}

Expand Down

0 comments on commit af5b47e

Please sign in to comment.