bc-java icon indicating copy to clipboard operation
bc-java copied to clipboard

Request new method: X509v2CRLBuilder.setThisUpdate()

Open stevemit opened this issue 1 year ago • 2 comments

The class X509v2CRLBuilder has methods setNextUpdate() but no method setThisUpdate(). "This update" is set only through the constructor. Subclassing outside the BC package doesn't help, as fields are package-private. The class V2TBSCertListGenerator is not a substitute, as it lacks a constructor from an existing CRL, which X509v2CRLBuilder has.

The use case is to compare two existing CRL's by first resetting both dates and then comparing encodings.

stevemit avatar Dec 07 '23 10:12 stevemit

This has been added to the latest in https://www.bouncycastle.org/betas

dghgit avatar Dec 08 '23 06:12 dghgit

Thanks! Not to press my luck, but I found that analogously I needed to also add setters for constructor arguments to X509v3CertificateBuilder. The use case is the same -- equivalence comparison in QA by resetting "variable" fields. The workaround is to copy the whole class to another package.

    public void setIssuer(X500Name issuer) {
    	tbsGen.setIssuer(issuer);
    }

    public void setSerialNumber(BigInteger serialNumber) {
    	tbsGen.setSerialNumber(new ASN1Integer(serialNumber));
    }
    
    public void setNotBefore(Time notBefore) {
    	tbsGen.setStartDate(notBefore);
    }
    
    public void setNotAfter(Time notAfter) {
    	tbsGen.setEndDate(notAfter);
    }
    
    public void setSubject(X500Name subject) {
    	tbsGen.setSubject(subject);
    }

    public void setSubjectPublicKeyInfo(SubjectPublicKeyInfo subjectPublicKeyInfo) {
    	tbsGen.setSubjectPublicKeyInfo(subjectPublicKeyInfo);
    }    

stevemit avatar Dec 08 '23 11:12 stevemit