UNPKG

@shockpkg/ria-packager

Version:

Package for creating Adobe AIR packages

42 lines (38 loc) 946 B
import { base64Decode } from '@shockpkg/plist-dom'; import { SecurityCertificate } from "../certificate.mjs"; /** * SecurityCertificateX509 object. */ export class SecurityCertificateX509 extends SecurityCertificate { /** * X509 certificate in PEM format. */ /** * SecurityCertificateX509 constructor. * * @param certificate X509 certificate in PEM format. */ constructor(certificate) { super(); this._certificate = certificate; } /** * Encode as PEM data. * * @returns The binary PEM data. */ encodePemData() { // Remove all the non-base64 lines, then decode. const base64 = this._certificate.split(/[\n\r]+/).map(s => s.trim()).filter(s => !s.startsWith('-')).join(''); return base64Decode(base64); } /** * Encode for certchain data. * * @returns Certchain data. */ encodeCertchain() { return this.encodePemData(); } } //# sourceMappingURL=x509.mjs.map