Skip to content

Commit

Permalink
fix csr sign
Browse files Browse the repository at this point in the history
  • Loading branch information
kirgene committed Feb 5, 2022
1 parent e754e04 commit 31280e3
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions server/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion server/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "connection-manager-api",
"version": "1.7.27",
"version": "1.7.28",
"description": "ModusBox Connection Manager API",
"main": "index.js",
"scripts": {
Expand Down
1 change: 1 addition & 0 deletions server/src/constants/Constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ module.exports = {
.default('1000')
.asInt(),
},
switchFQDN: env.get('SWITCH_FQDN').default('switch.example.com').asString(),
vault: {
endpoint: env.get('VAULT_ENDPOINT').required().asString(),
mounts: {
Expand Down
6 changes: 3 additions & 3 deletions server/src/pki_engine/VaultPKIEngine.js
Original file line number Diff line number Diff line change
Expand Up @@ -512,15 +512,15 @@ class VaultPKIEngine extends PKIEngine {
/**
* Sign Client (DFSP) CSR and return client certificate
* @param csr
* @param commonName
* @returns {Promise<*>}
*/
async sign (csr) {
const csrInfo = forge.pki.certificationRequestFromPem(csr);
async sign (csr, commonName) {
const { data } = await this.client.request({
path: `/${this.mounts.pki}/sign/${this.pkiClientRole}`,
method: 'POST',
json: {
common_name: csrInfo.subject.getField('CN').value,
common_name: commonName,
csr,
ttl: `${this.signExpiryHours}h`,
},
Expand Down
2 changes: 1 addition & 1 deletion server/src/service/DfspInboundService.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ exports.signDFSPInboundEnrollment = async (ctx, dfspId, enId) => {

const { csr } = enrollment;

const newCert = await pkiEngine.sign(csr);
const newCert = await pkiEngine.sign(csr, Constants.switchFQDN);
const certInfo = pkiEngine.getCertInfo(newCert);

const inboundEnrollment = {
Expand Down

0 comments on commit 31280e3

Please sign in to comment.