UNPKG

@wildboar/pkcs

Version:
37 lines (36 loc) 1.54 kB
import * as $ from "@wildboar/asn1/functional"; import { _decode_AlgorithmIdentifier, _encode_AlgorithmIdentifier, } from "../PKCS5v2-1/AlgorithmIdentifier.ta.mjs"; let _cached_decoder_for_PBKDF2_params_salt = null; /** * @summary Decodes an ASN.1 element into a(n) PBKDF2_params_salt * @function * @param {_Element} el The element being decoded. * @returns {PBKDF2_params_salt} The decoded data structure. */ export function _decode_PBKDF2_params_salt(el) { if (!_cached_decoder_for_PBKDF2_params_salt) { _cached_decoder_for_PBKDF2_params_salt = $._decode_inextensible_choice({ "UNIVERSAL 4": ["specified", $._decodeOctetString], "UNIVERSAL 16": ["otherSource", _decode_AlgorithmIdentifier], }); } return _cached_decoder_for_PBKDF2_params_salt(el); } let _cached_encoder_for_PBKDF2_params_salt = null; /** * @summary Encodes a(n) PBKDF2_params_salt 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 PBKDF2_params_salt, encoded as an ASN.1 Element. */ export function _encode_PBKDF2_params_salt(value, elGetter) { if (!_cached_encoder_for_PBKDF2_params_salt) { _cached_encoder_for_PBKDF2_params_salt = $._encode_choice({ specified: $._encodeOctetString, otherSource: _encode_AlgorithmIdentifier, }, $.BER); } return _cached_encoder_for_PBKDF2_params_salt(value, elGetter); } /* eslint-enable */