mirror of
https://github.com/nodejs/node.git
synced 2025-05-01 08:42:45 +00:00

* Split single monolithic file into multiple * Make Certificate methods static * Allow randomFill(Sync) to use any ArrayBufferView * Use internal/errors throughout * Improve arg validation in Hash/Hmac * Doc updates PR-URL: https://github.com/nodejs/node/pull/15231 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
41 lines
957 B
JavaScript
41 lines
957 B
JavaScript
'use strict';
|
|
|
|
const {
|
|
certExportChallenge,
|
|
certExportPublicKey,
|
|
certVerifySpkac
|
|
} = process.binding('crypto');
|
|
|
|
const {
|
|
toBuf
|
|
} = require('internal/crypto/util');
|
|
|
|
function verifySpkac(object) {
|
|
return certVerifySpkac(object);
|
|
}
|
|
|
|
function exportPublicKey(object, encoding) {
|
|
return certExportPublicKey(toBuf(object, encoding));
|
|
}
|
|
|
|
function exportChallenge(object, encoding) {
|
|
return certExportChallenge(toBuf(object, encoding));
|
|
}
|
|
|
|
// For backwards compatibility reasons, this cannot be converted into a
|
|
// ES6 Class.
|
|
function Certificate() {
|
|
if (!(this instanceof Certificate))
|
|
return new Certificate();
|
|
}
|
|
|
|
Certificate.prototype.verifySpkac = verifySpkac;
|
|
Certificate.prototype.exportPublicKey = exportPublicKey;
|
|
Certificate.prototype.exportChallenge = exportChallenge;
|
|
|
|
Certificate.exportChallenge = exportChallenge;
|
|
Certificate.exportPublicKey = exportPublicKey;
|
|
Certificate.verifySpkac = verifySpkac;
|
|
|
|
module.exports = Certificate;
|