mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-03-09 15:40:18 +00:00
Improved CertURL certificate loading.
This commit is contained in:
parent
944463b90a
commit
3b192b6295
6 changed files with 13 additions and 8 deletions
|
@ -251,7 +251,7 @@ module.exports.CreateWebAuthnModule = function () {
|
|||
function ASN1toPEM(pkBuffer) {
|
||||
if (!Buffer.isBuffer(pkBuffer)) { throw new Error("ASN1toPEM: pkBuffer must be Buffer."); }
|
||||
let type;
|
||||
if (pkBuffer.length == 65 && pkBuffer[0] == 0x04) { pkBuffer = Buffer.concat([new Buffer.from("3059301306072a8648ce3d020106082a8648ce3d030107034200", "hex"), pkBuffer]); type = 'PUBLIC KEY'; } else { type = 'CERTIFICATE'; }
|
||||
if (pkBuffer.length == 65 && pkBuffer[0] == 0x04) { pkBuffer = Buffer.concat([Buffer.from("3059301306072a8648ce3d020106082a8648ce3d030107034200", "hex"), pkBuffer]); type = 'PUBLIC KEY'; } else { type = 'CERTIFICATE'; }
|
||||
const b64cert = pkBuffer.toString('base64');
|
||||
let PEMKey = '';
|
||||
for (let i = 0; i < Math.ceil(b64cert.length / 64); i++) { const start = 64 * i; PEMKey += b64cert.substr(start, 64) + '\n'; }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue