本文整理汇总了TypeScript中pvutils.bufferToHexCodes函数的典型用法代码示例。如果您正苦于以下问题:TypeScript bufferToHexCodes函数的具体用法?TypeScript bufferToHexCodes怎么用?TypeScript bufferToHexCodes使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bufferToHexCodes函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: parseCMSSigned
export function parseCMSSigned() {
// region Initial check
if (cmsSignedBuffer.byteLength === 0) {
alert("Nothing to parse!");
return;
}
// endregion
// region Initial activities
document.getElementById("cms-dgst-algos").innerHTML = "";
document.getElementById("cms-certs").style.display = "none";
document.getElementById("cms-crls").style.display = "none";
const certificatesTable = document.getElementById("cms-certificates") as HTMLTableElement;
while (certificatesTable.rows.length > 1)
certificatesTable.deleteRow(certificatesTable.rows.length - 1);
const crlsTable = document.getElementById("cms-rev-lists") as HTMLTableElement;
while (crlsTable.rows.length > 1)
crlsTable.deleteRow(crlsTable.rows.length - 1);
// endregion
// region Decode existing CMS Signed Data
const asn1 = asn1js.fromBER(cmsSignedBuffer);
const cmsContentSimpl = new ContentInfo({ schema: asn1.result });
const cmsSignedSimpl = new SignedData({ schema: cmsContentSimpl.content });
// endregion
// region Put information about digest algorithms in the CMS Signed Data
const dgstmap: { [oid: string]: string } = {
"1.3.14.3.2.26": "SHA-1",
"2.16.840.1.101.3.4.2.1": "SHA-256",
"2.16.840.1.101.3.4.2.2": "SHA-384",
"2.16.840.1.101.3.4.2.3": "SHA-512"
};
for (let i = 0; i < cmsSignedSimpl.digestAlgorithms.length; i++) {
let typeval = dgstmap[cmsSignedSimpl.digestAlgorithms[i].algorithmId];
if (typeof typeval === "undefined")
typeval = cmsSignedSimpl.digestAlgorithms[i].algorithmId;
const ulrow = `<li><p><span>${typeval}</span></p></li>`;
document.getElementById("cms-dgst-algos").innerHTML = document.getElementById("cms-dgst-algos").innerHTML + ulrow;
}
// endregion
// region Put information about encapsulated content type
const contypemap: { [oid: string]: string } = {
"1.3.6.1.4.1.311.2.1.4": "Authenticode signing information",
"1.2.840.113549.1.7.1": "Data content"
};
let eContentType = contypemap[cmsSignedSimpl.encapContentInfo.eContentType];
if (typeof eContentType === "undefined")
eContentType = cmsSignedSimpl.encapContentInfo.eContentType;
document.getElementById("cms-encap-type").innerHTML = eContentType;
// endregion
// region Put information about included certificates
const rdnmap: { [oid: string]: string } = {
"2.5.4.6": "C",
"2.5.4.10": "OU",
"2.5.4.11": "O",
"2.5.4.3": "CN",
"2.5.4.7": "L",
"2.5.4.8": "S",
"2.5.4.12": "T",
"2.5.4.42": "GN",
"2.5.4.43": "I",
"2.5.4.4": "SN",
"1.2.840.113549.1.9.1": "E-mail"
};
if ("certificates" in cmsSignedSimpl) {
for (let cert of cmsSignedSimpl.certificates) {
if (cert instanceof Certificate) {
let ul = "<ul>";
for (let i = 0; i < cert.issuer.typesAndValues.length; i++) {
let typeval = rdnmap[cert.issuer.typesAndValues[i].type.toString()];
if (typeof typeval === "undefined")
typeval = cert.issuer.typesAndValues[i].type.toString();
const subjval = cert.issuer.typesAndValues[i].value.valueBlock.value;
const ulrow = `<li><p><span>${typeval}</span> ${subjval}</p></li>`;
ul = ul + ulrow;
}
ul = `${ul}</ul>`;
const row = certificatesTable.insertRow(certificatesTable.rows.length);
const cell0 = row.insertCell(0);
cell0.innerHTML = bufferToHexCodes(cert.serialNumber.valueBlock.valueHex);
const cell1 = row.insertCell(1);
cell1.innerHTML = ul;
}
}
//.........这里部分代码省略.........
示例2: ArrayBuffer
import * as pvutils from "pvutils";
pvutils.getUTCDate(new Date).getTime();
pvutils.getParametersValue({}, "name", "").charAt(0);
pvutils.getParametersValue({}, "name", 0).toFixed();
pvutils.getParametersValue({}, "name", true).valueOf();
pvutils.getParametersValue({}, "name", new Date).getTime();
pvutils.bufferToHexCodes(new ArrayBuffer(0)).charAt(0);
pvutils.bufferToHexCodes(new ArrayBuffer(0), 0).charAt(0);
pvutils.bufferToHexCodes(new ArrayBuffer(0), 0, 0).charAt(0);
pvutils.checkBufferParams({}, new ArrayBuffer(0), 0, 0).valueOf();
pvutils.utilFromBase(new Uint8Array(0), 0).toFixed();
pvutils.utilToBase(0, 0).byteLength;
pvutils.utilToBase(0, 0, 0).byteLength;
pvutils.utilConcatBuf(new ArrayBuffer(0), new ArrayBuffer(0), new ArrayBuffer(0), new ArrayBuffer(0)).byteLength;
pvutils.utilDecodeTC().toFixed();
pvutils.utilEncodeTC(0).byteLength;
pvutils.isEqualBuffer(new ArrayBuffer(0), new ArrayBuffer(0)) === true;
pvutils.padNumber(0, 0).charAt(0);
pvutils.toBase64("").charAt(0);