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

Copy constructor of org.bouncycastle.cms.SignerInfoGenerator

Open hayarobi opened this issue 1 year ago • 2 comments

The class org.bouncycastle.cms.SignerInfoGenerator has a constructor which combine origin generator and additional attribute table generator. public SignerInfoGenerator(SignerInfoGenerator original, CMSAttributeTableGenerator sAttrGen, CMSAttributeTableGenerator unsAttrGen) This constructor combines the fields of the original object with the parameters attrGen and unsAttrGen, but it does not retain the certHolder from the original object. I'm unsure whether this is a bug or intended behavior.

Please check the line about 70 in file SignerInfoGenerator.java https://github.com/bcgit/bc-java/blob/94fadb56f60b55cebf1028ef444362a9e8820bde/pkix/src/main/java/org/bouncycastle/cms/SignerInfoGenerator.java#L70C1-L84C1

    public SignerInfoGenerator(
        SignerInfoGenerator original,
        CMSAttributeTableGenerator sAttrGen,
        CMSAttributeTableGenerator unsAttrGen)
    {
        this.signerIdentifier = original.signerIdentifier;
        this.signer = original.signer;
        this.digestAlgorithm = original.digestAlgorithm;
        this.digester = original.digester;
        this.sigEncAlgFinder = original.sigEncAlgFinder;
        this.sAttrGen = sAttrGen;
        this.unsAttrGen = unsAttrGen;
    }

hayarobi avatar Dec 13 '24 02:12 hayarobi

I think I'd classify that as a bug. Thanks for the report, I've pushed a fix for it which should appear shortly.

dghgit avatar Dec 16 '24 00:12 dghgit

The fixed version is now up in https://downloads.bouncycastle.org/betas

dghgit avatar Jan 11 '25 23:01 dghgit