RFR: 8283082: sun.security.x509.X509CertImpl.delete("x509.info.validity") nulls out info field [v2]

Weijun Wang weijun at openjdk.org
Wed Jun 29 13:47:38 UTC 2022


On Wed, 29 Jun 2022 02:46:48 GMT, Jayashree Huttanagoudar <duke at openjdk.org> wrote:

>> Thank you for taking a look at the PR.
>> Sure I will address these comments.
>
>> The test can be much simpler than the program included in the bug report. Something like this:
>> 
>>     1. Create an empty `X509CertImpl`
>> 
>>     2. Add "x509.info"
>> 
>>     3. Add "x509.info.issuer"
>> 
>>     4. Remove "x509.info.issuer"
>> 
>>     5. Add "x509.info.issuer" again
>> 
>> 
>> Without the fix, step 4 removes the whole info and step 5 would fail.
> I am not a getting a clear idea about how to add issuer and delete etc. 
> Could you please point me to some example?

import sun.security.x509.X500Name;
import sun.security.x509.X509CertImpl;
import sun.security.x509.X509CertInfo;

public class A {
    public static void main(String[] args) throws Exception {
        var c = new X509CertImpl();
        c.set("x509.info", new X509CertInfo());
        c.set("x509.info.issuer", new X500Name("CN=one"));
        c.delete("x509.info.issuer");
        c.set("x509.info.issuer", new X500Name("CN=two"));
    }
}

-------------

PR: https://git.openjdk.org/jdk/pull/9306



More information about the security-dev mailing list