8296742: Illegal X509 Extension should not be created

Reviewed-by: mullan
This commit is contained in:
Weijun Wang 2022-11-22 22:21:50 +00:00
parent a6c418eaf8
commit e174558cad
28 changed files with 303 additions and 92 deletions

View file

@ -69,10 +69,13 @@ public class CRLReasonCodeExtension extends Extension {
* Create a CRLReasonCodeExtension with the passed in reason.
*
* @param critical true if the extension is to be treated as critical.
* @param reason the enumerated value for the reason code.
* @param reason the enumerated value for the reason code, must be positive.
*/
public CRLReasonCodeExtension(boolean critical, int reason)
throws IOException {
throws IOException {
if (reason <= 0) {
throw new IllegalArgumentException("reason code must be positive");
}
this.extensionId = PKIXExtensions.ReasonCode_Id;
this.critical = critical;
this.reasonCode = reason;