-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
5.0
-
x86
-
windows_2000
FULL PRODUCT VERSION :
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_04-b05)
Java HotSpot(TM) Client VM (build 1.5.0_04-b05, mixed mode, sharing)
A DESCRIPTION OF THE PROBLEM :
Because the output result of DerOutputStream#putEnumerated is not
correct, the reason code of the CRL extention part is not correct.
The INTEGER tag (0x02) is unnecessary.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
--------------------------------------------------------
CRLReasonCodeExtension entEx = new CRLReasonCodeExtension(false,4);
byte[] asn1 = entEx.getExtensionValue();
--------------------------------------------------------
When made CRL was displayed with IE,
the reason code of the CRL entry extension is illegal.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Expected ASN1 encode form : byte[] asn1
The first byte :0x0a --- tag of enumerated
The second byte :0x01 --- length
The third byte :0x04 --- value
ACTUAL -
The first byte :0x0a
The second byte :0x02
The third byte :0x01
The fourth byte :0x04
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import sun.security.util.DerValue;
import sun.security.x509.CRLReasonCodeExtension;
import jcom.impl.JComUtil;
public class DeroutputTest extends JComUtil {
public static void main(String[] args) {
DeroutputTest me = new DeroutputTest();
try {
me.setDebug(true);
me.execute();
} catch (Exception e) {
e.printStackTrace();
}
}
private void execute() throws Exception {
System.out.println("---It is wrong");
CRLReasonCodeExtension entExWrong = new CRLReasonCodeExtension(false,4);
System.out.println("len:" + entExWrong.getExtensionValue().length);
System.out.println("[0]:" + entExWrong.getExtensionValue()[0]);
System.out.println("[1]:" + entExWrong.getExtensionValue()[1]);
System.out.println("[2]:" + entExWrong.getExtensionValue()[2]);
System.out.println("[3]:" + entExWrong.getExtensionValue()[3]);
super.debugDerDump(entExWrong.getExtensionValue());
System.out.println("---It is correct");
DerValue dv = new DerValue(DerValue.tag_Enumerated,new byte[]{(byte)4});
CRLReasonCodeExtension entExRight = new CRLReasonCodeExtension(new Boolean(false),(Object)dv.toByteArray());
System.out.println("len:" + entExRight.getExtensionValue().length);
System.out.println("[0]:" + entExRight.getExtensionValue()[0]);
System.out.println("[1]:" + entExRight.getExtensionValue()[1]);
System.out.println("[2]:" + entExRight.getExtensionValue()[2]);
super.debugDerDump(entExRight.getExtensionValue());
}
}
======================================log
---It is wrong
len:4
[0]:10
[1]:2
[2]:1
[3]:4
01 tag:Enumerated(0A)
01 d:0104
---It is correct
len:3
[0]:10
[1]:1
[2]:4
01 tag:Enumerated(0A)
01 d:04
---------- END SOURCE ----------
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_04-b05)
Java HotSpot(TM) Client VM (build 1.5.0_04-b05, mixed mode, sharing)
A DESCRIPTION OF THE PROBLEM :
Because the output result of DerOutputStream#putEnumerated is not
correct, the reason code of the CRL extention part is not correct.
The INTEGER tag (0x02) is unnecessary.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
--------------------------------------------------------
CRLReasonCodeExtension entEx = new CRLReasonCodeExtension(false,4);
byte[] asn1 = entEx.getExtensionValue();
--------------------------------------------------------
When made CRL was displayed with IE,
the reason code of the CRL entry extension is illegal.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Expected ASN1 encode form : byte[] asn1
The first byte :0x0a --- tag of enumerated
The second byte :0x01 --- length
The third byte :0x04 --- value
ACTUAL -
The first byte :0x0a
The second byte :0x02
The third byte :0x01
The fourth byte :0x04
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import sun.security.util.DerValue;
import sun.security.x509.CRLReasonCodeExtension;
import jcom.impl.JComUtil;
public class DeroutputTest extends JComUtil {
public static void main(String[] args) {
DeroutputTest me = new DeroutputTest();
try {
me.setDebug(true);
me.execute();
} catch (Exception e) {
e.printStackTrace();
}
}
private void execute() throws Exception {
System.out.println("---It is wrong");
CRLReasonCodeExtension entExWrong = new CRLReasonCodeExtension(false,4);
System.out.println("len:" + entExWrong.getExtensionValue().length);
System.out.println("[0]:" + entExWrong.getExtensionValue()[0]);
System.out.println("[1]:" + entExWrong.getExtensionValue()[1]);
System.out.println("[2]:" + entExWrong.getExtensionValue()[2]);
System.out.println("[3]:" + entExWrong.getExtensionValue()[3]);
super.debugDerDump(entExWrong.getExtensionValue());
System.out.println("---It is correct");
DerValue dv = new DerValue(DerValue.tag_Enumerated,new byte[]{(byte)4});
CRLReasonCodeExtension entExRight = new CRLReasonCodeExtension(new Boolean(false),(Object)dv.toByteArray());
System.out.println("len:" + entExRight.getExtensionValue().length);
System.out.println("[0]:" + entExRight.getExtensionValue()[0]);
System.out.println("[1]:" + entExRight.getExtensionValue()[1]);
System.out.println("[2]:" + entExRight.getExtensionValue()[2]);
super.debugDerDump(entExRight.getExtensionValue());
}
}
======================================log
---It is wrong
len:4
[0]:10
[1]:2
[2]:1
[3]:4
01 tag:Enumerated(0A)
01 d:0104
---It is correct
len:3
[0]:10
[1]:1
[2]:4
01 tag:Enumerated(0A)
01 d:04
---------- END SOURCE ----------
- duplicates
-
JDK-6237027 Incorrect ASN.1 encoding of Enumerated types
-
- Resolved
-