@wildboar/pkcs
Version:
Public Key Cryptography Standard PDUs in TypeScript
30 lines (29 loc) • 1.05 kB
JavaScript
import { _decode_PrivateKeyInfo, _encode_PrivateKeyInfo, } from "../AsymmetricKeyPackageModuleV1/PrivateKeyInfo.ta.mjs";
let _cached_decoder_for_KeyBag = null;
/**
* @summary Decodes an ASN.1 element into a(n) KeyBag
* @function
* @param {_Element} el The element being decoded.
* @returns {KeyBag} The decoded data structure.
*/
export function _decode_KeyBag(el) {
if (!_cached_decoder_for_KeyBag) {
_cached_decoder_for_KeyBag = _decode_PrivateKeyInfo;
}
return _cached_decoder_for_KeyBag(el);
}
let _cached_encoder_for_KeyBag = null;
/**
* @summary Encodes a(n) KeyBag 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 KeyBag, encoded as an ASN.1 Element.
*/
export function _encode_KeyBag(value, elGetter) {
if (!_cached_encoder_for_KeyBag) {
_cached_encoder_for_KeyBag = _encode_PrivateKeyInfo;
}
return _cached_encoder_for_KeyBag(value, elGetter);
}
/* eslint-enable */