allow der encoding

This commit is contained in:
AJ ONeal 2018-12-16 00:45:59 -07:00
parent 2e24c43dee
commit 37ebdc0f62
1 changed files with 7 additions and 4 deletions

View File

@ -14,10 +14,7 @@ var CSR = module.exports = function rsacsr(opts) {
opts = CSR._prepare(opts);
return CSR.create(opts).then(function (bytes) {
return PEM.packBlock({
type: "CERTIFICATE REQUEST"
, bytes: bytes /* { jwk: jwk, domains: opts.domains } */
});
return CSR._encode(opts, bytes);
});
};
@ -75,6 +72,12 @@ CSR._prepare = function (opts) {
CSR.sync = function (opts) {
opts = CSR._prepare(opts);
var bytes = CSR.createSync(opts);
return CSR._encode(opts, bytes);
};
CSR._encode = function (opts, bytes) {
if ('der' === (opts.encoding||'').toLowerCase()) {
return bytes;
}
return PEM.packBlock({
type: "CERTIFICATE REQUEST"
, bytes: bytes /* { jwk: jwk, domains: opts.domains } */