Sha256: 0a4f1922e7b133bbba7a428000f48a5291668f73dd50f45077f61d53c50365c9

Contents?: true

Size: 590 Bytes

Versions: 28

Compression:

Stored size: 590 Bytes

Contents

var inherits = require('inherits');

var DEREncoder = require('./der');

function PEMEncoder(entity) {
  DEREncoder.call(this, entity);
  this.enc = 'pem';
};
inherits(PEMEncoder, DEREncoder);
module.exports = PEMEncoder;

PEMEncoder.prototype.encode = function encode(data, options) {
  var buf = DEREncoder.prototype.encode.call(this, data);

  var p = buf.toString('base64');
  var out = [ '-----BEGIN ' + options.label + '-----' ];
  for (var i = 0; i < p.length; i += 64)
    out.push(p.slice(i, i + 64));
  out.push('-----END ' + options.label + '-----');
  return out.join('\n');
};

Version data entries

28 entries across 28 versions & 11 rubygems

Version Path
disco_app-0.18.0 test/dummy/node_modules/asn1.js/lib/asn1/encoders/pem.js
disco_app-0.18.2 test/dummy/node_modules/asn1.js/lib/asn1/encoders/pem.js
disco_app-0.16.1 test/dummy/node_modules/asn1.js/lib/asn1/encoders/pem.js
disco_app-0.15.2 test/dummy/node_modules/asn1.js/lib/asn1/encoders/pem.js
disco_app-0.18.4 test/dummy/node_modules/asn1.js/lib/asn1/encoders/pem.js
disco_app-0.18.1 test/dummy/node_modules/asn1.js/lib/asn1/encoders/pem.js
disco_app-0.12.7.pre.puma.pre.3 test/dummy/node_modules/asn1.js/lib/asn1/encoders/pem.js
disco_app-0.14.0 test/dummy/node_modules/asn1.js/lib/asn1/encoders/pem.js
disco_app-0.13.6.pre.puma.pre.3 test/dummy/node_modules/asn1.js/lib/asn1/encoders/pem.js
enju_library-0.3.8 spec/dummy/node_modules/asn1.js/lib/asn1/encoders/pem.js
ilog-0.4.1 node_modules/asn1.js/lib/asn1/encoders/pem.js
ilog-0.4.0 node_modules/asn1.js/lib/asn1/encoders/pem.js
ilog-0.3.3 node_modules/asn1.js/lib/asn1/encoders/pem.js
jester-data-8.0.0 node_modules/asn1.js/lib/asn1/encoders/pem.js
ezii-os-5.2.1 node_modules/asn1.js/lib/asn1/encoders/pem.js
ezii-os-2.0.1 node_modules/asn1.js/lib/asn1/encoders/pem.js
ezii-os-1.1.0 node_modules/asn1.js/lib/asn1/encoders/pem.js
ezii-os-1.0.0 node_modules/asn1.js/lib/asn1/encoders/pem.js
ezii-os-0.0.0.1.0 node_modules/asn1.js/lib/asn1/encoders/pem.js
ezii-os-0.0.0.0.1 node_modules/asn1.js/lib/asn1/encoders/pem.js