• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript pvutils.bufferToHexCodes函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;
            }
        }
//.........这里部分代码省略.........
开发者ID:ArtemZag,项目名称:DefinitelyTyped,代码行数:101,代码来源:pkijs-tests.ts


示例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);
开发者ID:AbraaoAlves,项目名称:DefinitelyTyped,代码行数:31,代码来源:pvutils-tests.ts



注:本文中的pvutils.bufferToHexCodes函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript pvutils.stringToArrayBuffer函数代码示例发布时间:2022-05-25
下一篇:
TypeScript puppeteer-core.Browser类代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap