import * as asn1js from "asn1js"; import * as pvtsutils from "pvtsutils"; import * as pvutils from "pvutils"; import { RelativeDistinguishedNames, RelativeDistinguishedNamesSchema } from "./RelativeDistinguishedNames"; import { SingleResponse, SingleResponseJson, SingleResponseSchema } from "./SingleResponse"; import { Extension, ExtensionJson } from "./Extension"; import { Extensions, ExtensionsSchema } from "./Extensions"; import * as Schema from "./Schema"; import { AsnError } from "./errors"; import { PkiObject, PkiObjectParameters } from "./PkiObject"; import { EMPTY_BUFFER } from "./constants";
public version?: number; public tbsView!: Uint8Array; /** *@deprecatedSinceversion3.0.0
*/ public get tbs(): ArrayBuffer {
return pvtsutils.BufferSourceConverter.toArrayBuffer(this.tbsView);
}
/** *@deprecatedSinceversion3.0.0
*/ public set tbs(value: ArrayBuffer) { this.tbsView = new Uint8Array(value);
} public responderID: any; public producedAt!: Date; public responses!: SingleResponse[]; public responseExtensions?: Extension[];
//#region Get internal properties from parsed schema this.tbsView = (asn1.result.ResponseData as asn1js.Sequence).valueBeforeDecodeView;
if (RESPONSE_DATA_VERSION in asn1.result) this.version = asn1.result[RESPONSE_DATA_VERSION].valueBlock.valueDec;
if (asn1.result[RESPONSE_DATA_RESPONDER_ID].idBlock.tagNumber === 1) this.responderID = new RelativeDistinguishedNames({ schema: asn1.result[RESPONSE_DATA_RESPONDER_ID].valueBlock.value[0] }); else this.responderID = asn1.result[RESPONSE_DATA_RESPONDER_ID].valueBlock.value[0]; // OCTET_STRING
this.producedAt = asn1.result[RESPONSE_DATA_PRODUCED_AT].toDate(); this.responses = Array.from(asn1.result[RESPONSE_DATA_RESPONSES], element => new SingleResponse({ schema: element }));
if (RESPONSE_DATA_RESPONSE_EXTENSIONS in asn1.result) this.responseExtensions = Array.from(asn1.result[RESPONSE_DATA_RESPONSE_EXTENSIONS].valueBlock.value, element => new Extension({ schema: element })); //#endregion
}
public toSchema(encodeFlag = false): Schema.SchemaType { //#region Decode stored TBS value
let tbsSchema;
if (encodeFlag === false) { if (!this.tbsView.byteLength) {// No stored certificate TBS part
return ResponseData.schema();
}
const asn1 = asn1js.fromBER(this.tbsView);
AsnError.assert(asn1, "TBS Response Data");
tbsSchema = asn1.result;
} //#endregion //#region Create TBS schema via assembling from TBS parts else { const outputArray = [];
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.