Augment parseX509Output to also work with libressl
LibreSSL uses a different output separated and semantics, which broke the X509 parser. With some slight modifications both can be supported.
This commit is contained in:
parent
4d491b2d76
commit
0969cd76be
1 changed files with 4 additions and 3 deletions
|
|
@ -741,10 +741,11 @@ const internalCertificate = {
|
|||
*/
|
||||
parseX509Output: (line, prefix) => {
|
||||
// Remove the subject= part
|
||||
const subject_value = line.slice(prefix.length);
|
||||
const subject_value = line.slice(prefix.length).trim();
|
||||
|
||||
const subject = subject_value.split(/,(?=(?:(?:[^"]*"){2})*[^"]*$)/)
|
||||
.map( (e) => { return e.trim().split(' = ', 2); })
|
||||
const subject = subject_value.split(/[,/](?=(?:(?:[^"]*"){2})*[^"]*$)/)
|
||||
.filter( (e) => { return e.length > 0; } )
|
||||
.map( (e) => { return e.trim().split('=', 2).map( (p) => { return p.trim(); }); })
|
||||
.reduce((obj, [key, value]) => {
|
||||
obj[key] = value.replace(/^"/, '').replace(/"$/, '');
|
||||
return obj;
|
||||
|
|
|
|||
Loading…
Reference in a new issue