You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
370 B
22 lines
370 B
'use strict';
|
|
|
|
var PEM = module.exports;
|
|
|
|
//var Enc = require('@root/encoding/base64');
|
|
var Enc = require('./node/native.js');
|
|
|
|
PEM.packBlock = function(opts) {
|
|
// TODO allow for headers?
|
|
return (
|
|
'-----BEGIN ' +
|
|
opts.type +
|
|
'-----\n' +
|
|
Enc.bufToBase64(opts.bytes)
|
|
.match(/.{1,64}/g)
|
|
.join('\n') +
|
|
'\n' +
|
|
'-----END ' +
|
|
opts.type +
|
|
'-----'
|
|
);
|
|
};
|
|
|