From 19101e1a5622f035344ab189eeb6ce837eb77653 Mon Sep 17 00:00:00 2001 From: "nicolson%netscape.com" Date: Fri, 4 Oct 2002 22:46:04 +0000 Subject: [PATCH] Fix 162904: Missing invalidityDate in RevRequest in CMMF package. Update RevRequest to conform to RFC 2797. Also updated the CRLReason enumeration. --- .../org/mozilla/jss/pkix/cmmf/RevRequest.java | 86 ++++++++++++++++--- 1 file changed, 75 insertions(+), 11 deletions(-) diff --git a/security/jss/org/mozilla/jss/pkix/cmmf/RevRequest.java b/security/jss/org/mozilla/jss/pkix/cmmf/RevRequest.java index bb16e59deb7..9b1023608c8 100644 --- a/security/jss/org/mozilla/jss/pkix/cmmf/RevRequest.java +++ b/security/jss/org/mozilla/jss/pkix/cmmf/RevRequest.java @@ -43,7 +43,8 @@ import java.io.*; * issuerName Name, * serialNumber INTEGER, * reason CRLReason, - * passphrase OCTET STRING OPTIONAL, + * invalidityDate GeneralizedTime OPTIONAL, + * sharedSecret OCTET STRING OPTIONAL, * comment UTF8String OPTIONAL } * */ @@ -93,6 +94,16 @@ public class RevRequest implements ASN1Value { * field. */ public static final ENUMERATED removeFromCRL = new ENUMERATED(8); + /** + * A CRLReason, which can be used in the reason + * field. + */ + public static final ENUMERATED privilegeWithdrawn = new ENUMERATED(9); + /** + * A CRLReason, which can be used in the reason + * field. + */ + public static final ENUMERATED aACompromise = new ENUMERATED(10); /////////////////////////////////////////////////////////////////////// @@ -101,7 +112,8 @@ public class RevRequest implements ASN1Value { private ANY issuerName; private INTEGER serialNumber; private ENUMERATED reason; - private OCTET_STRING passphrase; // may be null + private GeneralizedTime invalidityDate; // may be null + private OCTET_STRING sharedSecret; // may be null private UTF8String comment; // may be null private SEQUENCE sequence; @@ -131,7 +143,9 @@ public class RevRequest implements ASN1Value { * superseded (4), * cessationOfOperation (5), * certificateHold (6), - * removeFromCRL (8) } + * removeFromCRL (8), + * privilegeWithdrawn (9), + * aACompromise (10) } * * These are all defined as constants in this class. */ @@ -139,12 +153,30 @@ public class RevRequest implements ASN1Value { return reason; } + /** + * Returns the invalidityDate field. Returns null + * if the field is not present. + */ + public GeneralizedTime getInvalidityDate() { + return invalidityDate; + } + /** * Returns the passphrase field. Returns * null if the field is not present. + * @deprecated The passphrase field has been renamed + * sharedSecret. Call getSharedSecret instead. */ public OCTET_STRING getPassphrase() { - return passphrase; + return sharedSecret; + } + + /** + * Returns the sharedSecret field. Returns + * null if the field is not present. + */ + public OCTET_STRING getSharedSecret() { + return sharedSecret; } /** @@ -162,6 +194,29 @@ public class RevRequest implements ASN1Value { private RevRequest() { } + /** + * Constructs a new RevRequest from its components, + * omitting the invalidityDate field. + * + * @deprecated This constructor is obsolete now that + * invalidityDate has been added to the class. + * + * @param issuerName The issuerName field. + * @param serialNumber The serialNumber field. + * @param reason The reason field. The constants defined + * in this class may be used. + * @param sharedSecret The sharedSecret field. This field is + * optional, so null may be used. + * @param comment The comment field. This field is optional, + * so null may be used. + */ + public RevRequest(ANY issuerName, INTEGER serialNumber, + ENUMERATED reason, OCTET_STRING sharedSecret, + UTF8String comment) + { + this(issuerName, serialNumber, reason, null, sharedSecret, comment); + } + /** * Constructs a new RevRequest from its components. * @@ -169,14 +224,18 @@ public class RevRequest implements ASN1Value { * @param serialNumber The serialNumber field. * @param reason The reason field. The constants defined * in this class may be used. - * @param passphrase The passphrase field. This field is + * @param invalidityDate The suggested value for the Invalidity Date + * CRL extension. This field is optional, so null may be + * used. + * @param sharedSecret The sharedSecret field. This field is * optional, so null may be used. * @param comment The comment field. This field is optional, * so null may be used. */ public RevRequest(ANY issuerName, INTEGER serialNumber, - ENUMERATED reason, OCTET_STRING passphrase, - UTF8String comment) { + ENUMERATED reason, GeneralizedTime invalidityDate, + OCTET_STRING sharedSecret, UTF8String comment) + { if( issuerName==null || serialNumber==null || reason==null ) { throw new IllegalArgumentException( "parameter to RevRequest constructor is null"); @@ -192,8 +251,11 @@ public class RevRequest implements ASN1Value { this.reason = reason; sequence.addElement(reason); - this.passphrase = passphrase; - sequence.addElement(passphrase); + this.invalidityDate = invalidityDate; + sequence.addElement(invalidityDate); + + this.sharedSecret = sharedSecret; + sequence.addElement(sharedSecret); this.comment = comment; sequence.addElement(comment); @@ -232,6 +294,7 @@ public class RevRequest implements ASN1Value { seqt.addElement(ANY.getTemplate()); seqt.addElement(INTEGER.getTemplate()); seqt.addElement(ENUMERATED.getTemplate()); + seqt.addOptionalElement(GeneralizedTime.getTemplate()); seqt.addOptionalElement(OCTET_STRING.getTemplate()); seqt.addOptionalElement(UTF8String.getTemplate()); } @@ -253,8 +316,9 @@ public class RevRequest implements ASN1Value { return new RevRequest( (ANY) seq.elementAt(0), (INTEGER) seq.elementAt(1), (ENUMERATED) seq.elementAt(2), - (OCTET_STRING) seq.elementAt(3), - (UTF8String) seq.elementAt(4) ); + (GeneralizedTime) seq.elementAt(3), + (OCTET_STRING) seq.elementAt(4), + (UTF8String) seq.elementAt(5) ); } }