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.
 
 
 
 
 

11 lines
375 B

import { isoBase64URL } from './iso/index.js';
/**
* Take a certificate in PEM format and convert it to bytes
*/
export function convertPEMToBytes(pem) {
const certBase64 = pem
.replace('-----BEGIN CERTIFICATE-----', '')
.replace('-----END CERTIFICATE-----', '')
.replace(/[\n ]/g, '');
return isoBase64URL.toBuffer(certBase64, 'base64');
}