Clarify the Certificate is not trusted Error. #286
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I was working with the library and ran into the 'Certificate is not trusted Error'.There was a CN mismatch, but not being familiar with the library I was unsure what this error message meant or why the certificate was not trusted. After some debugging I discovered it was a subject mismatch and a matching certificate was not found in the caStore.
This PR modified the error message to identify the possible issues to a consumer.
I'm not very satisfied with the error message. It represents two possible error cases and is much longer than the other error conditions. It would be nice to separate DER validation from the caStore.hasCertificate method, so this error messaged could be more concise.
I cannot pursue refactoring hasCertificate at the moment, so I am proposing just updating the error message for now. If the changes would be welcome open an issue and assign it to me. I'll try to get around to it when time allows.