Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use the existing public and private keys when reenrolling a user #513

Open
ih8d8 opened this issue Oct 11, 2021 · 1 comment
Open

Use the existing public and private keys when reenrolling a user #513

ih8d8 opened this issue Oct 11, 2021 · 1 comment

Comments

@ih8d8
Copy link

ih8d8 commented Oct 11, 2021

If I want to reenroll a user using fabric-ca-client CLI, it has this flag [--csr.keyrequest.reusekey] that makes the reenrolling process use the existing key pair of the user. However, the fabric-sdk-node doesn't seem to provide a similar option. The below snippet is taken from the reenroll function of FabricCAServices class:

// generate enrollment certificate pair for signing
let privateKey;
try {
	privateKey = await this.getCryptoSuite().generateKey();
} catch (e) {
	throw Error(`Failed to generate key for enrollment due to error [${e}]: ${e.stack}`);
}

// generate CSR using the subject of the current user's certificate
let csr;
try {
	csr = privateKey.generateCSR('CN=' + subject);
} catch (e) {
	throw Error(`Failed to generate CSR for enrollment due to error [${e}]`);
}

const response = await this._fabricCAClient.reenroll(csr, currentUser.getSigningIdentity(), attrReqs);

It generates a new pub/priv key for user when reenrolling. I suggest that the reenroll function accepts another parameter for specifying if the existing key pair need to be used or not.

@ih8d8 ih8d8 changed the title Use the existing public and private key when reenrolling a user Use the existing public and private keys when reenrolling a user Oct 11, 2021
@hs2361
Copy link

hs2361 commented Jan 25, 2022

@bestbeforetoday I'd like to take this issue up if it's not being currently worked on by someone else.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants