On Fri, 25 Sep 2020 23:00:22 GMT, Weijun Wang <[email protected]> wrote:
>> src/java.base/share/classes/sun/security/util/DerInputStream.java line 139:
>>
>>> 137: // does not accept constructed OCTET STRING.
>>> 138: DerValue v = getDerValue();
>>> 139: if (v.tag != DerValue.tag_OctetString) {
>>
>> Only this method checks tag of the DerValue?
>
> Yes, this is because `DerValue::getOctetString` allows constructed value but
> `DerInputStream::getOctetString` only
> accepts primitive value. This is for compatibility.
> All other methods will have tag checked inside the corresponding DerValue
> method. Do you prefer a fast fail?
I just wonder why the different handling. Do you know why? Is it really
used/needed, just curious?
-------------
PR: https://git.openjdk.java.net/jdk/pull/232