@wildboar/pkcs
Version:
Public Key Cryptography Standard PDUs in TypeScript
44 lines • 1.66 kB
text/typescript
import * as $ from "@wildboar/asn1/functional";
import { EnvelopedData } from "../PKCS-15/EnvelopedData.ta.mjs";
import { ReferencedValue } from "../PKCS-15/ReferencedValue.ta.mjs";
/**
* @summary ObjectValue
* @description
*
* ### ASN.1 Definition:
*
* ```asn1
* ObjectValue { Type } ::= CHOICE {
* indirect ReferencedValue {Type},
* direct [0] Type,
* indirect-protected [1] ReferencedValue {EnvelopedData {Type}},
* direct-protected [2] EnvelopedData {Type}
* }(CONSTRAINED BY {
* -- if indirection is being used, then it is expected that the reference
* -- points either to a (possibly enveloped) object of type -- Type -- or (key case) to a card-
* -- specific key file --})
* ```
*/
export type ObjectValue<Type> = {
indirect: ReferencedValue<Type>;
} | {
direct: Type;
} | {
indirect_protected: ReferencedValue<EnvelopedData<Type>>;
} | {
direct_protected: EnvelopedData<Type>;
};
/**
* @summary Returns a function that will decode an ASN.1 element into a(n) ObjectValue
* @function
* @param {_Element} el The element being decoded.
* @returns A function that will decode an ASN.1 element.
*/
export declare function _get_decoder_for_ObjectValue<Type>(_decode_Type: $.ASN1Decoder<Type>): $.ASN1Decoder<ObjectValue<Type>>;
/**
* @summary Returns a function that will encode a(n) ObjectValue into an ASN.1 Element.
* @function
* @returns A function that will encode a(n) ObjectValue as an ASN.1 element.
*/
export declare function _get_encoder_for_ObjectValue<Type>(_encode_Type: $.ASN1Encoder<Type>): $.ASN1Encoder<ObjectValue<Type>>;
//# sourceMappingURL=ObjectValue.ta.d.mts.map