import * as asn1js from "asn1js"; import * as pvutils from "pvutils"; import { PKIStatusInfo, PKIStatusInfoJson, PKIStatusInfoSchema } from "./PKIStatusInfo"; import { ContentInfo, ContentInfoJson, ContentInfoSchema } from "./ContentInfo"; import { SignedData } from "./SignedData"; import * as Schema from "./Schema"; import { id_ContentType_SignedData } from "./ObjectIdentifiers"; import { Certificate } from "./Certificate"; import { PkiObject, PkiObjectParameters } from "./PkiObject"; import { AsnError } from "./errors"; import { EMPTY_BUFFER, EMPTY_STRING } from "./constants"; import * as common from "./common";
public fromSchema(schema: Schema.SchemaType): void { // Clear input data first
pvutils.clearProps(schema, CLEAR_PROPS);
// Check the schema is valid const asn1 = asn1js.compareSchema(schema,
schema,
TimeStampResp.schema()
);
AsnError.assertSchema(asn1, this.className);
// Get internal properties from parsed schema this.status = new PKIStatusInfo({ schema: asn1.result[TIME_STAMP_RESP_STATUS] }); if (TIME_STAMP_RESP_TOKEN in asn1.result) this.timeStampToken = new ContentInfo({ schema: asn1.result[TIME_STAMP_RESP_TOKEN] });
}
public toSchema(): asn1js.Sequence { //#region Create array for output sequence const outputArray = [];
outputArray.push(this.status.toSchema()); if (this.timeStampToken) {
outputArray.push(this.timeStampToken.toSchema());
} //#endregion
//#region Construct and return new ASN.1 schema for this object
return (new asn1js.Sequence({
value: outputArray
})); //#endregion
}
private assertContentType(): asserts this is { timeStampToken: ContentInfo; } { if (!this.timeStampToken) { thrownew Error("timeStampToken is absent in TSP response");
} if (this.timeStampToken.contentType !== id_ContentType_SignedData) { // Must be a CMS signed data thrownew Error(`Wrong format of timeStampToken: ${this.timeStampToken.contentType}`);
}
}
}
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.