var RecipientEncryptedKeys_1; import { __decorate } from "tslib"; import { AsnProp, AsnPropTypes, AsnArray, AsnType, AsnTypeTypes, OctetString, } from "@peculiar/asn1-schema"; import { AlgorithmIdentifier, SubjectKeyIdentifier } from "@peculiar/asn1-x509"; import { CMSVersion, KeyEncryptionAlgorithmIdentifier, } from "./types.js"; import { IssuerAndSerialNumber } from "./issuer_and_serial_number.js"; import { OtherKeyAttribute } from "./other_key_attribute.js"; export class RecipientKeyIdentifier { subjectKeyIdentifier = new SubjectKeyIdentifier(); date; other; constructor(params = {}) { Object.assign(this, params); } } __decorate([ AsnProp({ type: SubjectKeyIdentifier }) ], RecipientKeyIdentifier.prototype, "subjectKeyIdentifier", void 0); __decorate([ AsnProp({ type: AsnPropTypes.GeneralizedTime, optional: true, }) ], RecipientKeyIdentifier.prototype, "date", void 0); __decorate([ AsnProp({ type: OtherKeyAttribute, optional: true, }) ], RecipientKeyIdentifier.prototype, "other", void 0); let KeyAgreeRecipientIdentifier = class KeyAgreeRecipientIdentifier { rKeyId; issuerAndSerialNumber; constructor(params = {}) { Object.assign(this, params); } }; __decorate([ AsnProp({ type: RecipientKeyIdentifier, context: 0, implicit: true, optional: true, }) ], KeyAgreeRecipientIdentifier.prototype, "rKeyId", void 0); __decorate([ AsnProp({ type: IssuerAndSerialNumber, optional: true, }) ], KeyAgreeRecipientIdentifier.prototype, "issuerAndSerialNumber", void 0); KeyAgreeRecipientIdentifier = __decorate([ AsnType({ type: AsnTypeTypes.Choice }) ], KeyAgreeRecipientIdentifier); export { KeyAgreeRecipientIdentifier }; export class RecipientEncryptedKey { rid = new KeyAgreeRecipientIdentifier(); encryptedKey = new OctetString(); constructor(params = {}) { Object.assign(this, params); } } __decorate([ AsnProp({ type: KeyAgreeRecipientIdentifier }) ], RecipientEncryptedKey.prototype, "rid", void 0); __decorate([ AsnProp({ type: OctetString }) ], RecipientEncryptedKey.prototype, "encryptedKey", void 0); let RecipientEncryptedKeys = RecipientEncryptedKeys_1 = class RecipientEncryptedKeys extends AsnArray { constructor(items) { super(items); Object.setPrototypeOf(this, RecipientEncryptedKeys_1.prototype); } }; RecipientEncryptedKeys = RecipientEncryptedKeys_1 = __decorate([ AsnType({ type: AsnTypeTypes.Sequence, itemType: RecipientEncryptedKey, }) ], RecipientEncryptedKeys); export { RecipientEncryptedKeys }; export class OriginatorPublicKey { algorithm = new AlgorithmIdentifier(); publicKey = new ArrayBuffer(0); constructor(params = {}) { Object.assign(this, params); } } __decorate([ AsnProp({ type: AlgorithmIdentifier }) ], OriginatorPublicKey.prototype, "algorithm", void 0); __decorate([ AsnProp({ type: AsnPropTypes.BitString }) ], OriginatorPublicKey.prototype, "publicKey", void 0); let OriginatorIdentifierOrKey = class OriginatorIdentifierOrKey { subjectKeyIdentifier; originatorKey; issuerAndSerialNumber; constructor(params = {}) { Object.assign(this, params); } }; __decorate([ AsnProp({ type: SubjectKeyIdentifier, context: 0, implicit: true, optional: true, }) ], OriginatorIdentifierOrKey.prototype, "subjectKeyIdentifier", void 0); __decorate([ AsnProp({ type: OriginatorPublicKey, context: 1, implicit: true, optional: true, }) ], OriginatorIdentifierOrKey.prototype, "originatorKey", void 0); __decorate([ AsnProp({ type: IssuerAndSerialNumber, optional: true, }) ], OriginatorIdentifierOrKey.prototype, "issuerAndSerialNumber", void 0); OriginatorIdentifierOrKey = __decorate([ AsnType({ type: AsnTypeTypes.Choice }) ], OriginatorIdentifierOrKey); export { OriginatorIdentifierOrKey }; export class KeyAgreeRecipientInfo { version = CMSVersion.v3; originator = new OriginatorIdentifierOrKey(); ukm; keyEncryptionAlgorithm = new KeyEncryptionAlgorithmIdentifier(); recipientEncryptedKeys = new RecipientEncryptedKeys(); constructor(params = {}) { Object.assign(this, params); } } __decorate([ AsnProp({ type: AsnPropTypes.Integer }) ], KeyAgreeRecipientInfo.prototype, "version", void 0); __decorate([ AsnProp({ type: OriginatorIdentifierOrKey, context: 0, }) ], KeyAgreeRecipientInfo.prototype, "originator", void 0); __decorate([ AsnProp({ type: OctetString, context: 1, optional: true, }) ], KeyAgreeRecipientInfo.prototype, "ukm", void 0); __decorate([ AsnProp({ type: KeyEncryptionAlgorithmIdentifier }) ], KeyAgreeRecipientInfo.prototype, "keyEncryptionAlgorithm", void 0); __decorate([ AsnProp({ type: RecipientEncryptedKeys }) ], KeyAgreeRecipientInfo.prototype, "recipientEncryptedKeys", void 0);