code: function unbundleCert(bundle) {
    var chain = bundle.trim().split('\n');
  
    var ca = [];
    var cert = [];
  
    for (var i = 0, len = chain.length; i < len; i++) {
      var line = chain[i].trim();
      if (!(line.length !== 0)) {
        continue;
      }
      cert.push(line);
      if (line.match(/-END CERTIFICATE-/)) {
        var joined = cert.join('\n');
        ca.push(joined);
        cert = [];
      }
    }
    return ca;
  }
docs: Unbundles a file composed of several certificates.
  http://www.benjiegillam.com/2012/06/node-dot-js-ssl-certificate-chain/