當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript openpgp.message.fromText方法代碼示例

本文整理匯總了TypeScript中openpgp.openpgp.message.fromText方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript openpgp.message.fromText方法的具體用法?TypeScript openpgp.message.fromText怎麽用?TypeScript openpgp.message.fromText使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在openpgp.openpgp.message的用法示例。


在下文中一共展示了openpgp.message.fromText方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1:

(async () => {
    let cipher = await openpgp.encrypt({
        message: openpgp.message.fromText('hello world'),
        passwords: 'super secure',
        armor: true,
    });
    let encrypted = cipher.data;

    let plain = await openpgp.decrypt({
        message: await openpgp.message.readArmored(encrypted),
        passwords: 'super secure',
    });

    return plain.data;
})();
開發者ID:CNBoland,項目名稱:DefinitelyTyped,代碼行數:15,代碼來源:openpgp-tests.ts

示例2: Uint8Array

openpgp.crypto.hash.getHashByteLength(openpgp.enums.hash.md5);

openpgp.crypto.random.getRandomBN(mpi, mpi);
openpgp.crypto.random.getRandomBytes(0);
// function removed from openpgp.crypto.random
// openpgp.crypto.random.getRandomValues(openpgp.util.str_to_Uint8Array(""));
// openpgp.crypto.random.getSecureRandom(0, 1);

openpgp.crypto.signature.sign(openpgp.enums.publicKey.rsa_encrypt, openpgp.enums.hash.md5, mpis, new Uint8Array([0, 1]), new Uint8Array([0, 1]));
openpgp.crypto.signature.verify(openpgp.enums.publicKey.rsa_encrypt, openpgp.enums.hash.md5, mpis, mpis, new Uint8Array([0, 1]), new Uint8Array([0, 1]));

openpgp.key.generate(keyoptions);
openpgp.key.readArmored("");

openpgp.message.fromBinary(new Uint8Array([0x01, 0x02, 0x03]));
openpgp.message.fromText("");
openpgp.message.readArmored("");

openpgp.packet.fromStructuredClone({});
openpgp.packet.newPacketFromTag("");

openpgp.util.Uint8Array_to_str(new Uint8Array([1, 0]));
openpgp.util.decode_utf8(new Uint8Array([1, 0]));
openpgp.util.encode_utf8("");
openpgp.util.getWebCrypto();
openpgp.util.hex_to_Uint8Array("");
openpgp.util.print_debug_hexarray_dump("");
openpgp.util.print_debug_hexstr_dump("");
openpgp.util.print_debug("");
openpgp.util.print_debug_hexstr_dump("");
openpgp.util.shiftRight(new Uint8Array([1, 0]), 1);
開發者ID:CNBoland,項目名稱:DefinitelyTyped,代碼行數:31,代碼來源:openpgp-tests.ts


注:本文中的openpgp.openpgp.message.fromText方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。