Q: How certificate_request is used in FabricCAClient request?
Hello, I'm just writing to get some clarification about how requestObj.certificate_request is used here https://github.com/hyperledger/fabric-sdk-node/blob/v2.2.11/fabric-ca-client/lib/FabricCAClient.js#L236
I'm using the class FabricCAServices and instantiating the class using the following piece of code
const fabricCAServices = new FabricCAServices(
`${url}:443`,
{
trustedRoots: [caInfo.caChain],
verify: true,
},
caInfo.caName
);
Then I use the method fabricCAServices.enroll passing an object that has the property csr. So, the method fabricCAServices.enroll passes the csr to fabricCAClient.enroll (here you can see it https://github.com/hyperledger/fabric-sdk-node/blob/v2.2.11/fabric-ca-client/lib/FabricCAServices.js#L219) then the method puts it in an object
const enrollRequest = {
certificate_request: csr
};
And finally it sends enrollRequest object to the request method without a signingIdentity (here you can see the method https://github.com/hyperledger/fabric-sdk-node/blob/v2.2.11/fabric-ca-client/lib/FabricCAClient.js#L236).
Since the signingIdentity is undefined (because the method fabricCAClient.enroll set it) the Authorization header is not set,rejectUnauthorized is set to true because verify: true when I instantiated the class, therefore, I get the following error:

I'm asking because I coded a script to create Identities and it was working until today, the latest change in my repository was the upgrade of the SDK from 2.2.9 to 2.2.11 but TBH I cannot blame the upgrade, I reviewed the code and it seems that nothing has changed in that logic for a long time.
So the question I have is: In the fabricCAClient.request method when
-
signingIdentityisundefined - AND
this._tlsOptions.verifyistrue - AND the property
certificate_requestexists inrequestObjHow the Authorization is header is set? Or Why thecertificate_requestis not used if thesigningIdentityisundefined?
I'm not an expert in SSL/TLS certificates and cannot not propose a fix (I tried a couple of stuff but none worked), I just want to understand if it is an edge case o something is missing in the logic. For the moment the quick fix for this is it to instantiate FabricCaServices w/o verify.
const fabricCAServices = new FabricCAServices(
`${url}:443`,
{
trustedRoots: [caInfo.caChain],
verify: false,
},
caInfo.caName
);
Thanks in advance,