Created attachment 1441245 [details]
Test case to replicate error
Description of problem:
Creating a CRL entry with a CRL Reason of "unspecified" (which has a value of 0) results in an encoding error due to the way JSS encodes ASN.1 enumerations in DerOutputStream. Instead of encoding the enumeration as 0x0A0100, the value portion of the TLV is omitted and it's encoded as 0x0A00.
From what I can tell from X.690 (https://www.itu.int/ITU-T/studygroups/com17/languages/X.690-0207.pdf), "The encoding of an enumerated value shall be that
of the integer value with which it is associated" and for integers "The encoding of an integer value shall be primitive. The contents octets shall consist of one or more octets."
Version-Release number of selected component (if applicable): 4.4
How reproducible: Always
Steps to Reproduce:
1. Compile and run the attached test case:
% javac -cp ~/.m2/repository/org/mozilla/jss/4.4.0/jss-4.4.0.jar EnumerationZeroTest.java
% java -cp ~/.m2/repository/org/mozilla/jss/4.4.0/jss-4.4.0.jar:. -Djava.library.path=/usr/lib64/jss EnumerationZeroTest
Actual results: The JDK X509CRL class cannot parse the generated CRL due to the way that the CRL reason is encoded. Instead of being encoded as 0x0A0100, it's encoded as 0x0A00.
Full encoded extension: 30090603551d1504020a00 Encoded CRL Reason: 0a00 Reason value: 0
Full encoded extension: 300a0603551d1504030a0101 Encoded CRL Reason: 0a0101 Reason value: 1
The JDK then throws an error when attempting to generate the CRL: "java.security.cert.CRLException: Invalid encoding: zero length Int value"
Expected results: The reason is encoded as 0x0A0100
Moved to RHEL 7.7 due to lack of development resource time.
This will be present in the RHEL 7.7 rebase due to bz#1659527.
Upstream commit: https://github.com/dogtagpki/jss/commit/fc3197ee80753d6a25956ad8c1d931fa94213661
# rpm -qa | grep jss
# rpm -qa | grep pki-*
Step of reproduction:
# javac -cp /usr/lib64/jss/jss4.jar EnumerationZeroTest.java
# java -cp /usr/lib64/jss/jss4.jar:. -Djava.library.path=/usr/lib64/jss EnumerationZeroTest
Proof of concept:
File has been attached.
Please find the attached test result and let me know if it needs additional test approach.
Compiled the test and analysed that its matching the expected result without generating any exception on jss-4.4.6-1.
Hence marking this bz verified.
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.
For information on the advisory, and where to find the updated
files, follow the link below.
If the solution does not work for you, open a new bug report.