@wildboar/pki-stub
Version:
X.510 PKI-Stub ASN.1 data structures in TypeScript
33 lines (32 loc) • 1.27 kB
JavaScript
import { _get_decoder_for_SIGNED, _get_encoder_for_SIGNED, } from "../PKI-Stub/SIGNED.ta.mjs";
import { _decode_TBSCertificate, _encode_TBSCertificate, } from "../PKI-Stub/TBSCertificate.ta.mjs";
let _cached_decoder_for_Certificate = null;
/**
* @summary Decodes an ASN.1 element into a(n) Certificate
* @function
* @param {_Element} el The element being decoded.
* @returns {Certificate} The decoded data structure.
*/
export function _decode_Certificate(el) {
if (!_cached_decoder_for_Certificate) {
_cached_decoder_for_Certificate =
_get_decoder_for_SIGNED(_decode_TBSCertificate);
}
return _cached_decoder_for_Certificate(el);
}
let _cached_encoder_for_Certificate = null;
/**
* @summary Encodes a(n) Certificate into an ASN.1 Element.
* @function
* @param value The element being encoded.
* @param elGetter A function that can be used to get new ASN.1 elements.
* @returns {_Element} The Certificate, encoded as an ASN.1 Element.
*/
export function _encode_Certificate(value, elGetter) {
if (!_cached_encoder_for_Certificate) {
_cached_encoder_for_Certificate =
_get_encoder_for_SIGNED(_encode_TBSCertificate);
}
return _cached_encoder_for_Certificate(value, elGetter);
}
/* eslint-enable */