import * as asn1js from "asn1js"; import * as pvutils from "pvutils"; import { CertificateSet, CertificateSetJson } from "./CertificateSet"; import { EMPTY_STRING } from "./constants"; import { AsnError } from "./errors"; import { PkiObject, PkiObjectParameters } from "./PkiObject"; import { RevocationInfoChoices, RevocationInfoChoicesJson } from "./RevocationInfoChoices"; import * as Schema from "./Schema";
export interface IOriginatorInfo { /** * Collection of certificates. In may contain originator certificates associated with several different * key management algorithms. It may also contain attribute certificates associated with the originator.
*/
certs?: CertificateSet; /** * Collection of CRLs. It is intended that the set contain information sufficient to determine whether * or not the certificates in the certs field are valid, but such correspondence is not necessary
*/
crls?: RevocationInfoChoices;
}
export type OriginatorInfoParameters = PkiObjectParameters & Partial<IOriginatorInfo>;
/** * Represents the OriginatorInfo structure described in [RFC5652](https://datatracker.ietf.org/doc/html/rfc5652)
*/
export class OriginatorInfo extends PkiObject implements IOriginatorInfo {
public certs?: CertificateSet; public crls?: RevocationInfoChoices;
/** * Initializes a new instance of the {@link CertificateSet} class * @param parameters Initialization parameters
*/
constructor(parameters: OriginatorInfoParameters = {}) { super();
if (parameters.schema) { this.fromSchema(parameters.schema);
}
}
/** * Returns default values for all class members * @param memberName String name for a class member * @returns Default value
*/ publicstatic override defaultValues(memberName: typeof CERTS): CertificateSet; publicstatic override defaultValues(memberName: typeof CRLS): RevocationInfoChoices; publicstatic override defaultValues(memberName: string): any { switch (memberName) { case CERTS: returnnew CertificateSet(); case CRLS: returnnew RevocationInfoChoices(); default: returnsuper.defaultValues(memberName);
}
}
/** * Compare values with default values for all class members * @param memberName String name for a class member * @param memberValue Value to compare with default value
*/ publicstatic compareWithDefault(memberName: string, memberValue: any): boolean { switch (memberName) { case CERTS: return (memberValue.certificates.length === 0); case CRLS: return ((memberValue.crls.length === 0) && (memberValue.otherRevocationInfos.length === 0)); default: returnsuper.defaultValues(memberName);
}
}
// Get internal properties from parsed schema if (CERTS in asn1.result) { this.certs = new CertificateSet({
schema: new asn1js.Set({
value: asn1.result.certs.valueBlock.value
})
});
} if (CRLS in asn1.result) { this.crls = new RevocationInfoChoices({
schema: new asn1js.Set({
value: asn1.result.crls.valueBlock.value
})
});
}
}
public toSchema(): asn1js.Sequence { const sequenceValue = [];
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.