Hướng dẫn what is crypto in javascript? - tiền điện tử trong javascript là gì?

Mã nguồn: lib/crypto.js lib/crypto.js

Mô -đun const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();1 cung cấp chức năng mật mã bao gồm một bộ trình bao bọc cho băm của OpenSSL, HMAC, mật mã, giải mã, dấu hiệu và xác minh các chức năng.

const { createHmac } = await import('node:crypto'); const secret = 'abcdefg'; const hash = createHmac('sha256', secret) .update('I love cupcakes') .digest('hex'); console.log(hash); // Prints: // c0fa1bc00531bd78ef38c628449c5102aeabd49b5dc3a2a516ea6ea959d6658econst crypto = require('node:crypto'); const secret = 'abcdefg'; const hash = crypto.createHmac('sha256', secret) .update('I love cupcakes') .digest('hex'); console.log(hash); // Prints: // c0fa1bc00531bd78ef38c628449c5102aeabd49b5dc3a2a516ea6ea959d6658e

Xác định xem hỗ trợ tiền điện tử không khả dụng##

Node.js có thể được xây dựng mà không bao gồm hỗ trợ cho mô -đun const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();1. Trong những trường hợp như vậy, việc cố gắng const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();3 từ const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();4 hoặc gọi const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();5 sẽ dẫn đến một lỗi bị ném.

Khi sử dụng CommonJS, có thể bắt được lỗi bằng cách sử dụng thử/bắt:

let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }

Khi sử dụng từ khóa ESM const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();3 từ vựng, lỗi chỉ có thể bị bắt nếu trình xử lý cho const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();7 được đăng ký trước khi cố gắng tải mô -đun được thực hiện (ví dụ, sử dụng mô -đun tải trước).

Khi sử dụng ESM, nếu có khả năng mã có thể được chạy trên bản dựng Node.js nơi hỗ trợ Crypto không được bật, hãy xem xét sử dụng chức năng const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();8 thay vì từ khóa từ vựng const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();3:

let crypto; try { crypto = await import('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }

Lớp: ________ 70##

Đã thêm vào: V0.11.8

SPKAC là cơ chế yêu cầu ký giấy chứng nhận được NetScape thực hiện ban đầu và được chỉ định chính thức như là một phần của phần tử const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string1 của HTML5.

const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string2 không được chấp nhận vì HTML 5.2 và các dự án mới không nên sử dụng yếu tố này nữa.

Mô -đun const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();1 cung cấp lớp const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string0 để làm việc với dữ liệu SPKAC. Cách sử dụng phổ biến nhất là xử lý đầu ra được tạo bởi phần tử HTML5 const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string2. Node.js sử dụng triển khai SPKAC của OpenSSL trong nội bộ.

Phương pháp tĩnh: ________ 76##

  • const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string7 | | | |
  • const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string8 Mã hóa chuỗi const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string7.
  • Trả về: Thành phần thách thức của cấu trúc dữ liệu const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string7, bao gồm khóa công khai và thách thức.
const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string

Phương pháp tĩnh: ________ 81##

  • const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string7 | | | |
  • const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string8 Mã hóa chuỗi const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string7.
  • Trả về: Thành phần thách thức của cấu trúc dữ liệu const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string7, bao gồm khóa công khai và thách thức.
const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>

Phương pháp tĩnh: ________ 81##

  • const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string7 | | | |
  • const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string8 Mã hóa chuỗi const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string7.
  • Trả về: Thành phần thách thức của cấu trúc dữ liệu const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string7, bao gồm khóa công khai và thách thức.
Phương pháp tĩnh: ________ 81#

Trả về: Thành phần khóa công khai của cấu trúc dữ liệu const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string7, bao gồm khóa công khai và một thách thức.#

Phương pháp tĩnh: ________ 86#

import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false4##

Trả về: import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false0 Nếu cấu trúc dữ liệu const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string7 đã cho là hợp lệ, import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false2 khác.

const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false8##

Đã thêm vào: V0.11.8

  • const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string7 | | | |
  • const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string8 Mã hóa chuỗi const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string7.
  • Trả về: Thành phần thách thức của cấu trúc dữ liệu const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string7, bao gồm khóa công khai và thách thức.
const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringlet crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }03##

Đã thêm vào: V0.11.8

  • const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string7 | | | |
  • const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string8 Mã hóa chuỗi const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string7.
  • Trả về: Thành phần thách thức của cấu trúc dữ liệu const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string7, bao gồm khóa công khai và thách thức.
const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }08##

Đã thêm vào: V0.11.8

  • const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string7 | | | |
  • const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string8 Mã hóa chuỗi const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string7.
  • Trả về: Thành phần thách thức của cấu trúc dữ liệu const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string7, bao gồm khóa công khai và thách thức.
import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false

Phương pháp tĩnh: ________ 81##

Trả về: Thành phần khóa công khai của cấu trúc dữ liệu const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string7, bao gồm khóa công khai và một thách thức.

  • Phương pháp tĩnh: ________ 86#

Trả về: import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false0 Nếu cấu trúc dữ liệu const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string7 đã cho là hợp lệ, import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false2 khác.

  • import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false
  • API kế thừa#

Là một giao diện kế thừa, có thể tạo các trường hợp mới của lớp import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false3 như được minh họa trong các ví dụ dưới đây.

Các phiên bản của lớp const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string0 có thể được tạo bằng từ khóa import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false6 hoặc bằng cách gọi import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false7 như một hàm:

let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }0

Lớp: ________ 115#

let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }1

Đã thêm vào: V0.1.94

let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }2

let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }28##

Trả về: Thành phần khóa công khai của cấu trúc dữ liệu const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string7, bao gồm khóa công khai và một thách thức.

  • Phương pháp tĩnh: ________ 86#
  • Trả về: import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false0 Nếu cấu trúc dữ liệu const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string7 đã cho là hợp lệ, import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false2 khác.

import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false

let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }36##

API kế thừa#

  • Là một giao diện kế thừa, có thể tạo các trường hợp mới của lớp import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false3 như được minh họa trong các ví dụ dưới đây.

Các phiên bản của lớp const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string0 có thể được tạo bằng từ khóa import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false6 hoặc bằng cách gọi import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false7 như một hàm:

Nếu tùy chọn let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }45 được đặt trong quá trình tạo phiên bản let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }46, hàm này sẽ trả về chính xác let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }45 byte.

let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }48##

Đã thêm vào: v1.0.0

  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }49 | | | |
  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }50 let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }51 Tùy chọn
    • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }52
    • const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string8 Mã hóa chuỗi để sử dụng khi let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }49 là một chuỗi.
  • Trả về: Đối với chuỗi phương pháp.

Khi sử dụng chế độ mã hóa được xác thực (let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }37, let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }38, let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }39 và let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }40 hiện được hỗ trợ), phương thức let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }59 đặt giá trị được sử dụng cho tham số đầu vào được xác thực (AAD) bổ sung.

Tùy chọn let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }52 là tùy chọn cho let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }37 và let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }39. Khi sử dụng let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }38, tùy chọn let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }52 phải được chỉ định và giá trị của nó phải khớp với độ dài của bản rõ trong byte. Xem Chế độ CCM.

Phương pháp let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }59 phải được gọi trước let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }17.

let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }67##

Đã thêm vào: V0.7.1

  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }68 Mặc định: import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false0Default: import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false0
  • Trả về: Đối với chuỗi phương pháp.

Khi sử dụng chế độ mã hóa được xác thực (let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }37, let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }38, let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }39 và let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }40 hiện được hỗ trợ), phương thức let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }59 đặt giá trị được sử dụng cho tham số đầu vào được xác thực (AAD) bổ sung.

Tùy chọn let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }52 là tùy chọn cho let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }37 và let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }39. Khi sử dụng let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }38, tùy chọn let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }52 phải được chỉ định và giá trị của nó phải khớp với độ dài của bản rõ trong byte. Xem Chế độ CCM.

Phương pháp let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }59 phải được gọi trước let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }17.

let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }78##

  • Đã thêm vào: V0.7.1
  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }68 Mặc định: import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false0
  • Khi sử dụng các thuật toán mã hóa khối, lớp let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }15 sẽ tự động thêm phần đệm vào dữ liệu đầu vào vào kích thước khối thích hợp. Để vô hiệu hóa cuộc gọi đệm mặc định let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }71.
  • Khi let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }68 là import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false2, độ dài của toàn bộ dữ liệu đầu vào phải là bội số của kích thước khối của mật mã hoặc let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }18 sẽ gây ra lỗi. Vô hiệu hóa đệm tự động là hữu ích cho phần đệm không chuẩn, ví dụ bằng cách sử dụng let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }75 thay vì đệm PKCS.

Phương pháp let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }76 phải được gọi trước let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }18.

let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }79 | | |

let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }80 Mã hóa dữ liệu.

let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }29 Mã hóa giá trị trả về.#

Trả lại: |

  • Cập nhật mật mã với let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }79. Nếu đối số let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }80 được đưa ra, đối số let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }79 là một chuỗi sử dụng mã hóa được chỉ định. Nếu đối số let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }80 không được đưa ra, let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }79 phải là let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }32, let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }88 hoặc let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }89. Nếu let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }79 là let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }32, let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }88 hoặc let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }89, thì let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }80 bị bỏ qua.

let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }29 chỉ định định dạng đầu ra của dữ liệu được mã hóa. Nếu let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }29 được chỉ định, một chuỗi sử dụng mã hóa được chỉ định được trả về. Nếu không có let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }29 được cung cấp, một let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }32 sẽ được trả về.

  • Phương pháp let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }17 có thể được gọi nhiều lần với dữ liệu mới cho đến khi let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }18 được gọi. Gọi let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }17 sau khi let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }18 sẽ dẫn đến lỗi bị ném.
  • Lớp: ________ 203#

Đã thêm vào: V0.1.94

Kéo dài:

let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }3

Các trường hợp của lớp let crypto; try { crypto = await import('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }03 được sử dụng để giải mã dữ liệu. Lớp học có thể được sử dụng theo một trong hai cách:

let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }4

Là một luồng vừa có thể đọc và có thể ghi, trong đó dữ liệu được mã hóa đơn giản được viết để tạo ra dữ liệu không được mã hóa ở phía có thể đọc được, hoặc

let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }5

let crypto; try { crypto = await import('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }16##

Trả lại: |

  • Khi sử dụng các thuật toán mã hóa khối, lớp let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }15 sẽ tự động thêm phần đệm vào dữ liệu đầu vào vào kích thước khối thích hợp. Để vô hiệu hóa cuộc gọi đệm mặc định let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }71.
  • Khi let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }68 là import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false2, độ dài của toàn bộ dữ liệu đầu vào phải là bội số của kích thước khối của mật mã hoặc let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }18 sẽ gây ra lỗi. Vô hiệu hóa đệm tự động là hữu ích cho phần đệm không chuẩn, ví dụ bằng cách sử dụng let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }75 thay vì đệm PKCS.

Phương pháp let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }76 phải được gọi trước let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }18.

let crypto; try { crypto = await import('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }24##

  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }49 | | | |
  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }50 let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }51 Tùy chọn
    • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }52
    • const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string8 Mã hóa chuỗi để sử dụng khi let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }49 là một chuỗi.
  • Trả về: Đối với chuỗi phương pháp.

Khi sử dụng chế độ mã hóa được xác thực (let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }37, let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }38, let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }39 và let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }40 hiện được hỗ trợ), phương thức let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }59 đặt giá trị được sử dụng cho tham số đầu vào được xác thực (AAD) bổ sung.

Tùy chọn let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }52 là tùy chọn cho let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }37 và let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }39. Khi sử dụng let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }38, tùy chọn let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }52 phải được chỉ định và giá trị của nó phải khớp với độ dài của bản rõ trong byte. Xem Chế độ CCM.

Phương pháp let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }59 phải được gọi trước let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }17.

Đã thêm vào: V0.7.1

let crypto; try { crypto = await import('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }43##

  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }49 | | | |
  • const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string8 Mã hóa chuỗi để sử dụng khi let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }49 là một chuỗi.
  • Trả về: Đối với chuỗi phương pháp.

Khi sử dụng chế độ mã hóa được xác thực (let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }37, let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }38, let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }39 và let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }40 hiện được hỗ trợ), phương thức let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }59 đặt giá trị được sử dụng cho tham số đầu vào được xác thực (AAD) bổ sung.

Phương pháp let crypto; try { crypto = await import('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }51 phải được gọi trước let crypto; try { crypto = await import('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }05 cho chế độ let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }38 hoặc trước let crypto; try { crypto = await import('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }06 cho các chế độ let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }37 và let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }39 và let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }40. let crypto; try { crypto = await import('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }51 chỉ có thể được gọi một lần.

Khi truyền một chuỗi làm thẻ xác thực, vui lòng xem xét các cảnh báo khi sử dụng chuỗi làm đầu vào cho các API mật mã.

let crypto; try { crypto = await import('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }63##

Đã thêm vào: V0.7.1

  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }68 Mặc định: import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false0Default: import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false0
  • Trả về: Đối với chuỗi phương pháp.

Khi dữ liệu đã được mã hóa mà không có phần đệm khối tiêu chuẩn, gọi let crypto; try { crypto = await import('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }66 sẽ vô hiệu hóa đệm tự động để ngăn chặn let crypto; try { crypto = await import('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }06 kiểm tra và loại bỏ đệm.

Tắt phần đệm tự động sẽ chỉ hoạt động nếu độ dài của dữ liệu đầu vào là bội số của kích thước khối ciphers.

Phương pháp let crypto; try { crypto = await import('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }68 phải được gọi trước let crypto; try { crypto = await import('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }06.

let crypto; try { crypto = await import('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }70##

  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }79 | | |
  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }80 mã hóa chuỗi let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }79.
  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }29 Mã hóa giá trị trả về.
  • Trả lại: |

Cập nhật giải mã với let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }79. Nếu đối số let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }80 được đưa ra, đối số let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }79 là một chuỗi sử dụng mã hóa được chỉ định. Nếu đối số let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }80 không được đưa ra, let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }79 phải là let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }32. Nếu let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }79 là let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }32 thì let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }80 bị bỏ qua.

let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }29 chỉ định định dạng đầu ra của dữ liệu được mã hóa. Nếu let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }29 được chỉ định, một chuỗi sử dụng mã hóa được chỉ định được trả về. Nếu không có let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }29 được cung cấp, một let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }32 sẽ được trả về.

Phương pháp let crypto; try { crypto = await import('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }05 có thể được gọi nhiều lần với dữ liệu mới cho đến khi let crypto; try { crypto = await import('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }06 được gọi. Gọi let crypto; try { crypto = await import('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }05 sau let crypto; try { crypto = await import('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }06 sẽ dẫn đến lỗi bị ném.

Lớp: ________ 292##

Đã thêm vào: V0.5.0

Lớp let crypto; try { crypto = await import('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }92 là một tiện ích để tạo ra các trao đổi khóa Diffie-Hellman.

Các thể hiện của lớp let crypto; try { crypto = await import('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }92 có thể được tạo bằng hàm let crypto; try { crypto = await import('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }95.

let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }6

let crypto; try { crypto = await import('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }96##

Đã thêm vào: V0.5.0

  • Lớp let crypto; try { crypto = await import('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }92 là một tiện ích để tạo ra các trao đổi khóa Diffie-Hellman.
  • Các thể hiện của lớp let crypto; try { crypto = await import('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }92 có thể được tạo bằng hàm let crypto; try { crypto = await import('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }95.
  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }29 Mã hóa giá trị trả về.
  • Trả lại: |

Cập nhật giải mã với let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }79. Nếu đối số let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }80 được đưa ra, đối số let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }79 là một chuỗi sử dụng mã hóa được chỉ định. Nếu đối số let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }80 không được đưa ra, let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }79 phải là let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }32. Nếu let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }79 là let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }32 thì let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }80 bị bỏ qua.

let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }29 chỉ định định dạng đầu ra của dữ liệu được mã hóa. Nếu let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }29 được chỉ định, một chuỗi sử dụng mã hóa được chỉ định được trả về. Nếu không có let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }29 được cung cấp, một let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }32 sẽ được trả về.

const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string11##

Đã thêm vào: V0.5.0

  • Lớp let crypto; try { crypto = await import('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }92 là một tiện ích để tạo ra các trao đổi khóa Diffie-Hellman.
  • Trả lại: |

Cập nhật giải mã với let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }79. Nếu đối số let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }80 được đưa ra, đối số let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }79 là một chuỗi sử dụng mã hóa được chỉ định. Nếu đối số let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }80 không được đưa ra, let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }79 phải là let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }32. Nếu let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }79 là let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }32 thì let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }80 bị bỏ qua.

const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string16##

Đã thêm vào: V0.5.0

  • Lớp let crypto; try { crypto = await import('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }92 là một tiện ích để tạo ra các trao đổi khóa Diffie-Hellman.
  • Trả lại: |

Cập nhật giải mã với let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }79. Nếu đối số let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }80 được đưa ra, đối số let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }79 là một chuỗi sử dụng mã hóa được chỉ định. Nếu đối số let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }80 không được đưa ra, let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }79 phải là let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }32. Nếu let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }79 là let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }32 thì let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }80 bị bỏ qua.

const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string21##

Đã thêm vào: V0.5.0

  • Lớp let crypto; try { crypto = await import('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }92 là một tiện ích để tạo ra các trao đổi khóa Diffie-Hellman.
  • Trả lại: |

Cập nhật giải mã với let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }79. Nếu đối số let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }80 được đưa ra, đối số let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }79 là một chuỗi sử dụng mã hóa được chỉ định. Nếu đối số let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }80 không được đưa ra, let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }79 phải là let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }32. Nếu let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }79 là let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }32 thì let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }80 bị bỏ qua.

const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string26##

Đã thêm vào: V0.5.0

  • Lớp let crypto; try { crypto = await import('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }92 là một tiện ích để tạo ra các trao đổi khóa Diffie-Hellman.
  • Trả lại: |

Cập nhật giải mã với let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }79. Nếu đối số let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }80 được đưa ra, đối số let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }79 là một chuỗi sử dụng mã hóa được chỉ định. Nếu đối số let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }80 không được đưa ra, let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }79 phải là let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }32. Nếu let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }79 là let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }32 thì let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }80 bị bỏ qua.

const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string31##

Đã thêm vào: V0.5.0

  • Lớp let crypto; try { crypto = await import('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }92 là một tiện ích để tạo ra các trao đổi khóa Diffie-Hellman.
  • Trả lại: |

Cập nhật giải mã với let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }79. Nếu đối số let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }80 được đưa ra, đối số let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }79 là một chuỗi sử dụng mã hóa được chỉ định. Nếu đối số let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }80 không được đưa ra, let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }79 phải là let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }32. Nếu let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }79 là let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }32 thì let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }80 bị bỏ qua.

const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string36##

Đã thêm vào: V0.5.0

  • Lớp let crypto; try { crypto = await import('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }92 là một tiện ích để tạo ra các trao đổi khóa Diffie-Hellman.
  • Các thể hiện của lớp let crypto; try { crypto = await import('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }92 có thể được tạo bằng hàm let crypto; try { crypto = await import('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }95.

let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }6

const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string47##

Đã thêm vào: V0.5.0

  • Lớp let crypto; try { crypto = await import('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }92 là một tiện ích để tạo ra các trao đổi khóa Diffie-Hellman.
  • Các thể hiện của lớp let crypto; try { crypto = await import('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }92 có thể được tạo bằng hàm let crypto; try { crypto = await import('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }95.

let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }6

const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string58##

let crypto; try { crypto = await import('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }97 | | | |

let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }80 Mã hóa chuỗi let crypto; try { crypto = await import('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }97.

Trả lại: |

  • const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string61
  • const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string62
  • const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string63
  • const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string64

Lớp: ________ 365##

Đã thêm vào: V0.7.5

Lớp const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string65 lấy một nhóm modp nổi tiếng làm đối số của nó. Nó hoạt động giống như let crypto; try { crypto = await import('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }92, ngoại trừ việc nó không cho phép thay đổi các khóa sau khi tạo. Nói cách khác, nó không thực hiện các phương thức const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string68 hoặc const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string69.

let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }7

Các nhóm sau được hỗ trợ:

  • const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string70 (2048 bit, RFC 3526 Phần 3)
  • const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string71 (3072 bit, RFC 3526 Phần 4)
  • const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string72 (4096 bit, RFC 3526 Phần 5)
  • const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string73 (6144 bit, RFC 3526 Phần 6)
  • const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string74 (8192 bit, RFC 3526 Phần 7)

Các nhóm sau vẫn được hỗ trợ nhưng không dùng nữa (xem Caveats):

  • const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string75 (768 bit, RFC 2409 Phần 6.1)
  • const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string76 (1024 bit, RFC 2409 Phần 6.2)
  • const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string77 (1536 bit, RFC 3526 Phần 2)

Các nhóm không dùng nữa có thể bị xóa trong các phiên bản tương lai của Node.js.

Lớp: ________ 378##

Đã thêm vào: v0.11.14

Lớp const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string78 là một tiện ích để tạo các trao đổi khóa đường cong elip Diffie-Hellman (ECDH).

Các phiên bản của lớp const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string78 có thể được tạo bằng hàm const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string81.

let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }8

Phương pháp tĩnh: ________ 382##

Đã thêm vào: v10.0.0

  • const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string83 | | | |
  • const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string84
  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }80 Mã hóa chuỗi const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string83.
  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }29 Mã hóa giá trị trả về.
  • const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string88 Mặc định: const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string89Default: const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string89
  • Trả lại: |

Chuyển đổi khóa công khai EC Diffie-Hellman được chỉ định bởi const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string83 và const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string84 thành định dạng được chỉ định bởi const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string88. Đối số const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string88 chỉ định mã hóa điểm và có thể là const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string94, const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string89 hoặc const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string96. Khóa được cung cấp được giải thích bằng cách sử dụng let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }80 được chỉ định và khóa được trả về được mã hóa bằng cách sử dụng let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }29 được chỉ định.

Sử dụng const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string99 để có được danh sách các tên đường cong có sẵn. Trên các bản phát hành OpenSSL gần đây, const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>00 cũng sẽ hiển thị tên và mô tả của từng đường cong elip có sẵn.

Nếu const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string88 không được chỉ định, điểm sẽ được trả về ở định dạng const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string89.

Nếu let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }80 không được cung cấp, const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string83 dự kiến ​​sẽ là một let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }32, let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }88 hoặc let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }89.

Ví dụ (giải nén một khóa):

let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }9

const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>08##

  • let crypto; try { crypto = await import('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }97 | | | |
  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }80 Mã hóa chuỗi let crypto; try { crypto = await import('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }97.
  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }29 Mã hóa giá trị trả về.
  • Trả lại: |

Chuyển đổi khóa công khai EC Diffie-Hellman được chỉ định bởi const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string83 và const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string84 thành định dạng được chỉ định bởi const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string88. Đối số const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string88 chỉ định mã hóa điểm và có thể là const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string94, const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string89 hoặc const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string96. Khóa được cung cấp được giải thích bằng cách sử dụng let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }80 được chỉ định và khóa được trả về được mã hóa bằng cách sử dụng let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }29 được chỉ định.

Sử dụng const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string99 để có được danh sách các tên đường cong có sẵn. Trên các bản phát hành OpenSSL gần đây, const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>00 cũng sẽ hiển thị tên và mô tả của từng đường cong elip có sẵn.

Nếu const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string88 không được chỉ định, điểm sẽ được trả về ở định dạng const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string89.

const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>27##

Đã thêm vào: v0.11.14

  • Lớp const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string78 là một tiện ích để tạo các trao đổi khóa đường cong elip Diffie-Hellman (ECDH).
  • const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string88 Mặc định: const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string89Default: const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string89
  • Trả lại: |

Chuyển đổi khóa công khai EC Diffie-Hellman được chỉ định bởi const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string83 và const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string84 thành định dạng được chỉ định bởi const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string88. Đối số const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string88 chỉ định mã hóa điểm và có thể là const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string94, const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string89 hoặc const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string96. Khóa được cung cấp được giải thích bằng cách sử dụng let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }80 được chỉ định và khóa được trả về được mã hóa bằng cách sử dụng let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }29 được chỉ định.

Sử dụng const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string99 để có được danh sách các tên đường cong có sẵn. Trên các bản phát hành OpenSSL gần đây, const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>00 cũng sẽ hiển thị tên và mô tả của từng đường cong elip có sẵn.

Nếu const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string88 không được chỉ định, điểm sẽ được trả về ở định dạng const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string89.

const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>40##

Đã thêm vào: v0.11.14

  • Lớp const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string78 là một tiện ích để tạo các trao đổi khóa đường cong elip Diffie-Hellman (ECDH).
  • Các phiên bản của lớp const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string78 có thể được tạo bằng hàm const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string81.

Phương pháp tĩnh: ________ 382#

const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>45##

Đã thêm vào: v0.11.14

  • Lớp const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string78 là một tiện ích để tạo các trao đổi khóa đường cong elip Diffie-Hellman (ECDH).
  • const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string88 Mặc định: const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string89Default: const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string89
  • Trả lại: |

Chuyển đổi khóa công khai EC Diffie-Hellman được chỉ định bởi const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string83 và const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string84 thành định dạng được chỉ định bởi const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string88. Đối số const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string88 chỉ định mã hóa điểm và có thể là const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string94, const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string89 hoặc const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string96. Khóa được cung cấp được giải thích bằng cách sử dụng let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }80 được chỉ định và khóa được trả về được mã hóa bằng cách sử dụng let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }29 được chỉ định.

Phương pháp tĩnh: ________ 382#

const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>58##

Đã thêm vào: v0.11.14

  • Lớp const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string78 là một tiện ích để tạo các trao đổi khóa đường cong elip Diffie-Hellman (ECDH).
  • Các phiên bản của lớp const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string78 có thể được tạo bằng hàm const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string81.

Phương pháp tĩnh: ________ 382#

Đã thêm vào: v10.0.0

const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>71##

Đã thêm vào: V0.11.14Deprecated kể từ: V5.2.0Deprecated since: v5.2.0

  • const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string48 | | | |
  • const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string8 Mã hóa chuỗi const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string48.

Đặt khóa công khai EC Diffie-Hellman. Nếu const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string8 được cung cấp const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string48 dự kiến ​​sẽ là một chuỗi; Nếu không, một let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }32, let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }88 hoặc let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }89 được dự kiến.

Thông thường không có lý do để gọi phương thức này vì const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string78 chỉ yêu cầu khóa riêng và khóa công khai của bên kia để tính toán bí mật được chia sẻ. Thông thường const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>81 hoặc const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>82 sẽ được gọi. Phương thức const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>82 cố gắng tạo điểm/khóa công khai được liên kết với khóa riêng đang được đặt.

Ví dụ (có được một bí mật chia sẻ):

let crypto; try { crypto = await import('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }0

Lớp: ________ 484##

Đã thêm vào: V0.1.92

  • Kéo dài:

Lớp const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>84 là một tiện ích để tạo các tiêu hóa dữ liệu băm. Nó có thể được sử dụng theo một trong hai cách:

  • Là một luồng vừa có thể đọc và có thể ghi, trong đó dữ liệu được viết để tạo ra một tiêu hóa băm được tính toán ở phía có thể đọc được hoặc
  • Sử dụng các phương pháp const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>86 và const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>87 để tạo ra băm được tính toán.

Phương pháp const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>88 được sử dụng để tạo các trường hợp const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>84. Các đối tượng const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>84 không được tạo trực tiếp bằng từ khóa import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false6.

Ví dụ: Sử dụng các đối tượng const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>84 làm luồng:

let crypto; try { crypto = await import('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }1

Ví dụ: Sử dụng các luồng const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>84 và đường ống:

let crypto; try { crypto = await import('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }2

Ví dụ: Sử dụng các phương pháp const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>86 và const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>87:

let crypto; try { crypto = await import('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }3

const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>96##

Đã thêm vào: V13.1.0

  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }50 let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }51 Tùy chọn
  • Trả lại:

Tạo một đối tượng const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>84 mới chứa một bản sao sâu của trạng thái bên trong của đối tượng const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>84 hiện tại.

Đối số let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }50 tùy chọn kiểm soát hành vi luồng. Đối với các hàm băm XOF như import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false02, tùy chọn import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false03 có thể được sử dụng để chỉ định độ dài đầu ra mong muốn tính bằng byte.

Một lỗi được ném khi một nỗ lực được thực hiện để sao chép đối tượng const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>84 sau khi phương thức const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>87 của nó đã được gọi.

let crypto; try { crypto = await import('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }4

import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false06##

Đã thêm vào: V0.1.92

  • Kéo dài:
  • Lớp const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>84 là một tiện ích để tạo các tiêu hóa dữ liệu băm. Nó có thể được sử dụng theo một trong hai cách:

Là một luồng vừa có thể đọc và có thể ghi, trong đó dữ liệu được viết để tạo ra một tiêu hóa băm được tính toán ở phía có thể đọc được hoặc

Sử dụng các phương pháp const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>86 và const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>87 để tạo ra băm được tính toán.

import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false13##

  • Phương pháp const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>88 được sử dụng để tạo các trường hợp const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>84. Các đối tượng const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>84 không được tạo trực tiếp bằng từ khóa import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false6.
  • Ví dụ: Sử dụng các đối tượng const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>84 làm luồng:

Ví dụ: Sử dụng các luồng const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>84 và đường ống:

Ví dụ: Sử dụng các phương pháp const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>86 và const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>87:

Đã thêm vào: V13.1.0#

let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }50 let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }51 Tùy chọn

  • Trả lại:

Tạo một đối tượng const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>84 mới chứa một bản sao sâu của trạng thái bên trong của đối tượng const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>84 hiện tại.

  • Đối số let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }50 tùy chọn kiểm soát hành vi luồng. Đối với các hàm băm XOF như import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false02, tùy chọn import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false03 có thể được sử dụng để chỉ định độ dài đầu ra mong muốn tính bằng byte.
  • Một lỗi được ném khi một nỗ lực được thực hiện để sao chép đối tượng const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>84 sau khi phương thức const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>87 của nó đã được gọi.

const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string8 Mã hóa giá trị trả về.

Trả lại: |

let crypto; try { crypto = await import('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }5

Tính toán tiêu hóa của tất cả các dữ liệu được truyền để được băm (sử dụng phương pháp const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>86). Nếu const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string8 được cung cấp, một chuỗi sẽ được trả về; nếu không thì một let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }32 được trả về.

Đối tượng const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>84 không thể được sử dụng lại sau khi phương thức const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>87 đã được gọi. Nhiều cuộc gọi sẽ gây ra lỗi.

let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }79 | | |

let crypto; try { crypto = await import('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }7

import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false39##

let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }50 let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }51 Tùy chọn

  • Kéo dài:
  • Lớp const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>84 là một tiện ích để tạo các tiêu hóa dữ liệu băm. Nó có thể được sử dụng theo một trong hai cách:

Là một luồng vừa có thể đọc và có thể ghi, trong đó dữ liệu được viết để tạo ra một tiêu hóa băm được tính toán ở phía có thể đọc được hoặc

Sử dụng các phương pháp const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>86 và const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>87 để tạo ra băm được tính toán.

import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false47##

  • Phương pháp const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>88 được sử dụng để tạo các trường hợp const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>84. Các đối tượng const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>84 không được tạo trực tiếp bằng từ khóa import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false6.
  • Ví dụ: Sử dụng các đối tượng const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>84 làm luồng:

Ví dụ: Sử dụng các luồng const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>84 và đường ống:

Ví dụ: Sử dụng các phương pháp const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>86 và const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>87:

Đã thêm vào: V13.1.0#

let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }50 let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }51 Tùy chọn

Hầu hết các ứng dụng nên xem xét sử dụng API import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false62 mới thay vì truyền các khóa dưới dạng chuỗi hoặc let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }32S do các tính năng bảo mật được cải thiện.

import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false62 Các trường hợp có thể được chuyển cho các chủ đề khác thông qua import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false73. Máy thu có được import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false62 nhân bản và import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false62 không cần được liệt kê trong đối số import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false76.

Phương pháp tĩnh: ________ 577##

Đã thêm vào: v15.0.0

  • const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string83
  • Trả lại:

Ví dụ: Chuyển đổi thể hiện import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false79 thành import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false62:

let crypto; try { crypto = await import('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }8

import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false81##

    • import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false82: Kích thước khóa tính bằng bit (RSA, DSA).
    • import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false83: Số mũ công cộng (RSA).
    • import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false84: Tên của tin nhắn Digest (RSA-PSS).
    • import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false85: Tên của tin nhắn Tiêu hóa được sử dụng bởi MGF1 (RSA-PSS).
    • import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false86: Độ dài muối tối thiểu tính bằng byte (RSA-PSS).
    • import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false87: Kích thước của import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false88 tính bằng bit (DSA).
    • import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false89: Tên của đường cong (EC).

Tài sản này chỉ tồn tại trên các khóa không đối xứng. Tùy thuộc vào loại khóa, đối tượng này chứa thông tin về khóa. Không có thông tin nào có được thông qua thuộc tính này có thể được sử dụng để xác định duy nhất một khóa hoặc để thỏa hiệp bảo mật của khóa.

Đối với các khóa RSA-PSS, nếu vật liệu chính chứa chuỗi import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false90, các thuộc tính import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false84, import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false85 và import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false86 sẽ được đặt.

Các chi tiết quan trọng khác có thể được phơi bày thông qua API này bằng các thuộc tính bổ sung.

import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false94##

import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false82: Kích thước khóa tính bằng bit (RSA, DSA).

  • import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false83: Số mũ công cộng (RSA).
  • import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false84: Tên của tin nhắn Digest (RSA-PSS).
  • import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false85: Tên của tin nhắn Tiêu hóa được sử dụng bởi MGF1 (RSA-PSS).
  • import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false86: Độ dài muối tối thiểu tính bằng byte (RSA-PSS).
  • import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false87: Kích thước của import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false88 tính bằng bit (DSA).
  • import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false89: Tên của đường cong (EC).
  • Tài sản này chỉ tồn tại trên các khóa không đối xứng. Tùy thuộc vào loại khóa, đối tượng này chứa thông tin về khóa. Không có thông tin nào có được thông qua thuộc tính này có thể được sử dụng để xác định duy nhất một khóa hoặc để thỏa hiệp bảo mật của khóa.
  • Đối với các khóa RSA-PSS, nếu vật liệu chính chứa chuỗi import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false90, các thuộc tính import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false84, import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false85 và import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false86 sẽ được đặt.
  • Các chi tiết quan trọng khác có thể được phơi bày thông qua API này bằng các thuộc tính bổ sung.

Đối với các khóa không đối xứng, thuộc tính này đại diện cho loại khóa. Các loại khóa được hỗ trợ là:

const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();06##

  • import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false95 (OID 1.2.840.113549.1.1.1)
  • import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false96 (OID 1.2.840.113549.1.1.10)

import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false97 (OID 1.2.840.10040.4.1)

  • import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false98 (OID 1.2.840.10045.2.1)

import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false99 (OID 1.3.101.110)

  • const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();00 (OID 1.3.101.111)
  • const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();01 (OID 1.3.101.112)

const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();02 (OID 1.3.101.113)

  • const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();03 (OID 1.2.840.113549.1.3.1)
  • const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();01 (OID 1.3.101.112)
  • const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();02 (OID 1.3.101.113)
  • const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();03 (OID 1.2.840.113549.1.3.1)

Thuộc tính này là const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();04 cho các loại import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false62 không được công nhận và các khóa đối xứng.

let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }50:

Trả lại: | |

const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();38##

Đối với các khóa đối xứng, các tùy chọn mã hóa sau đây có thể được sử dụng:

  • const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string88: Phải là const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();09 (mặc định) hoặc const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();10.
  • Trả lại:

Ví dụ: Chuyển đổi thể hiện import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false79 thành import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false62:

const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();44##

Added in: v11.6.0

import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false82: Kích thước khóa tính bằng bit (RSA, DSA).

const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();46##

Added in: v11.6.0

import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false82: Kích thước khóa tính bằng bit (RSA, DSA).

import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false83: Số mũ công cộng (RSA).#

import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false84: Tên của tin nhắn Digest (RSA-PSS).

  • import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false85: Tên của tin nhắn Tiêu hóa được sử dụng bởi MGF1 (RSA-PSS).

import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false86: Độ dài muối tối thiểu tính bằng byte (RSA-PSS).

  • import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false87: Kích thước của import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false88 tính bằng bit (DSA).
  • import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false89: Tên của đường cong (EC).

Tài sản này chỉ tồn tại trên các khóa không đối xứng. Tùy thuộc vào loại khóa, đối tượng này chứa thông tin về khóa. Không có thông tin nào có được thông qua thuộc tính này có thể được sử dụng để xác định duy nhất một khóa hoặc để thỏa hiệp bảo mật của khóa.

Ví dụ: Sử dụng các đối tượng const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();51 và const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();61 làm luồng:

let crypto; try { crypto = await import('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }9

Ví dụ: Sử dụng các phương pháp const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();54 và const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();63:

const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string0

const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();64##

  • const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string37 | | | | | | |
    • const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();66
    • const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();67
    • import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false86
  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }29 Mã hóa giá trị trả về.
  • Trả lại: |

Tính toán chữ ký trên tất cả các dữ liệu được truyền qua bằng cách sử dụng const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();54 hoặc const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();71.

Nếu const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string37 không phải là import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false62, chức năng này hoạt động như thể const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string37 đã được truyền đến import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false66. Nếu đó là một đối tượng, các thuộc tính bổ sung sau đây có thể được thông qua:

  • const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();66 Đối với DSA và ECDSA, tùy chọn này chỉ định định dạng của chữ ký được tạo. Nó có thể là một trong những điều sau đây:

    • const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();16 (mặc định): Mã hóa chữ ký được mã hóa DER.1 const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();78.
    • const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();79: Định dạng chữ ký const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();80 như đề xuất trong IEEE-P1363.
  • const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();67 Giá trị đệm tùy chọn cho RSA, một trong những điều sau đây:

    • const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();82 (mặc định)
    • const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();83

    const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();84 sẽ sử dụng MGF1 với hàm băm tương tự được sử dụng để ký tin nhắn như được chỉ định trong Phần 3.1 của RFC 4055, trừ khi hàm băm MGF1 đã được chỉ định như là một phần của khóa tuân thủ phần 3.3 của RFC 4055.

  • import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false86 Độ dài muối khi đệm là const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();84. Giá trị đặc biệt const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();87 đặt chiều dài muối thành kích thước tiêu hóa, const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();88 (mặc định) đặt nó thành giá trị tối đa cho phép.

Nếu let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }29 được cung cấp, một chuỗi được trả về; nếu không thì một let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }32 được trả về.

Đối tượng const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();51 không thể được sử dụng một lần nữa sau khi phương thức const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();53 đã được gọi. Nhiều cuộc gọi đến const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();53 sẽ dẫn đến một lỗi bị ném.

const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();94##

  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }79 | | |
  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }80 mã hóa chuỗi let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }79.

Cập nhật nội dung const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();51 với let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }79 đã cho, mã hóa được đưa ra trong let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }80. Nếu const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string8 không được cung cấp và let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }79 là một chuỗi, một mã hóa của import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false21 được thực thi. Nếu let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }79 là let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }32, let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }88 hoặc let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }89, thì let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }80 bị bỏ qua.

Điều này có thể được gọi nhiều lần với dữ liệu mới khi nó được truyền phát.

Lớp: ________ 661##

Đã thêm vào: V0.1.92

  • Kéo dài:

Lớp const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();61 là một tiện ích để xác minh chữ ký. Nó có thể được sử dụng theo một trong hai cách:

  • Là một luồng có thể ghi trong đó dữ liệu bằng văn bản được sử dụng để xác nhận đối với chữ ký được cung cấp hoặc
  • Sử dụng các phương thức const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();63 và const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string12 để xác minh chữ ký.

Phương pháp const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string13 được sử dụng để tạo các phiên bản const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();61. Các đối tượng const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();61 không được tạo trực tiếp bằng từ khóa import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false6.

Xem const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();51 để biết ví dụ.

const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string18##

  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }79 | | |
  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }80 mã hóa chuỗi let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }79.

Cập nhật nội dung const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();51 với let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }79 đã cho, mã hóa được đưa ra trong let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }80. Nếu const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string8 không được cung cấp và let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }79 là một chuỗi, một mã hóa của import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false21 được thực thi. Nếu let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }79 là let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }32, let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }88 hoặc let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }89, thì let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }80 bị bỏ qua.

Điều này có thể được gọi nhiều lần với dữ liệu mới khi nó được truyền phát.

const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string33##

  • Lớp: ________ 661#
    • const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();66
    • const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();67
    • import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false86
  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }29 Mã hóa giá trị trả về.
  • Trả lại: |
  • Tính toán chữ ký trên tất cả các dữ liệu được truyền qua bằng cách sử dụng const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();54 hoặc const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();71.

Nếu const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string37 không phải là import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false62, chức năng này hoạt động như thể const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string37 đã được truyền đến import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false66. Nếu đó là một đối tượng, các thuộc tính bổ sung sau đây có thể được thông qua:

const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();66 Đối với DSA và ECDSA, tùy chọn này chỉ định định dạng của chữ ký được tạo. Nó có thể là một trong những điều sau đây:

  • const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();16 (mặc định): Mã hóa chữ ký được mã hóa DER.1 const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();78.

    • const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();16 (mặc định): Mã hóa chữ ký được mã hóa DER.1 const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();78.
    • const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();79: Định dạng chữ ký const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();80 như đề xuất trong IEEE-P1363.
  • const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();67 Giá trị đệm tùy chọn cho RSA, một trong những điều sau đây:

    • const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();82 (mặc định)
    • const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();83

    const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();84 sẽ sử dụng MGF1 với hàm băm tương tự được sử dụng để ký tin nhắn như được chỉ định trong Phần 3.1 của RFC 4055, trừ khi hàm băm MGF1 đã được chỉ định như là một phần của khóa tuân thủ phần 3.3 của RFC 4055.

  • import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false86 Độ dài muối khi đệm là const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();84. Giá trị đặc biệt const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();87 đặt chiều dài muối thành kích thước tiêu hóa, const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();88 (mặc định) đặt nó thành giá trị tối đa cho phép.

Nếu let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }29 được cung cấp, một chuỗi được trả về; nếu không thì một let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }32 được trả về.

Đối tượng const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string70 không thể được sử dụng lại sau khi const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string12 được gọi. Nhiều cuộc gọi đến const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string12 sẽ dẫn đến một lỗi bị ném.

Bởi vì các khóa công khai có thể được lấy từ các khóa riêng, khóa riêng có thể được thông qua thay vì khóa công khai.

Lớp: ________ 773##

Đã thêm vào: V15.6.0

Đóng gói chứng chỉ X509 và cung cấp quyền truy cập chỉ đọc vào thông tin của nó.

const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string1

const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string74##

Đã thêm vào: V15.6.0

  • Đóng gói chứng chỉ X509 và cung cấp quyền truy cập chỉ đọc vào thông tin của nó.

const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string76##

Đã thêm vào: V15.6.0

  • Đóng gói chứng chỉ X509 và cung cấp quyền truy cập chỉ đọc vào thông tin của nó.

const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string78##

  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }49 | | | Chứng chỉ PEM hoặc DER mã hóa X509.
  • Loại: Sẽ là import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false0 nếu đây là chứng chỉ của Chứng chỉ (CA).
    • const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string79Default: const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string82.
  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }50

const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string81 const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string82, const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string83 hoặc const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string84. Mặc định: const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string82.

Trả lại: | Trả về const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string79 Nếu chứng chỉ khớp, const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();04 nếu không.

Kiểm tra xem chứng chỉ có khớp với địa chỉ email đã cho hay không.

Nếu tùy chọn const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string88 không được xác định hoặc được đặt thành const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string82, đối tượng chứng chỉ chỉ được xem xét nếu phần mở rộng tên thay thế chủ đề không tồn tại hoặc không chứa bất kỳ địa chỉ email nào.

const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string94##

  • Nếu tùy chọn const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string88 được đặt thành const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string83 và nếu phần mở rộng tên thay thế chủ đề không tồn tại hoặc không chứa địa chỉ email phù hợp, thì chủ đề chứng chỉ được xem xét.
  • Loại: Sẽ là import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false0 nếu đây là chứng chỉ của Chứng chỉ (CA).
    • const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string79Default: const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string82.
    • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }50Default: import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false0.
    • const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string81 const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string82, const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string83 hoặc const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string84. Mặc định: const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string82.Default: import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false0.
    • Trả lại: | Trả về const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string79 Nếu chứng chỉ khớp, const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();04 nếu không.Default: import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false2.
    • Kiểm tra xem chứng chỉ có khớp với địa chỉ email đã cho hay không.Default: import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false2.
  • Nếu tùy chọn const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string88 không được xác định hoặc được đặt thành const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string82, đối tượng chứng chỉ chỉ được xem xét nếu phần mở rộng tên thay thế chủ đề không tồn tại hoặc không chứa bất kỳ địa chỉ email nào.

Nếu tùy chọn const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string88 được đặt thành const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string83 và nếu phần mở rộng tên thay thế chủ đề không tồn tại hoặc không chứa địa chỉ email phù hợp, thì chủ đề chứng chỉ được xem xét.

Nếu tùy chọn const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string88 được đặt thành const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string84, đối tượng chứng chỉ không bao giờ được xem xét, ngay cả khi chứng chỉ không chứa tên thay thế chủ đề.

const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string95

const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>02 Mặc định: import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false0.

Nếu tùy chọn const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string88 không được xác định hoặc được đặt thành const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string82, đối tượng chứng chỉ chỉ được xem xét nếu phần mở rộng tên thay thế chủ đề không tồn tại hoặc không chứa bất kỳ địa chỉ email nào.

const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>22##

  • Nếu tùy chọn const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string88 được đặt thành const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string83 và nếu phần mở rộng tên thay thế chủ đề không tồn tại hoặc không chứa địa chỉ email phù hợp, thì chủ đề chứng chỉ được xem xét.
  • Nếu tùy chọn const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string88 được đặt thành const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string84, đối tượng chứng chỉ không bao giờ được xem xét, ngay cả khi chứng chỉ không chứa tên thay thế chủ đề.

const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string95

const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>02 Mặc định: import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false0.

const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>28##

Đã thêm vào: V15.6.0

  • const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>04 Mặc định: import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false0.
  • const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>06 Mặc định: import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false2.

const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>08 Mặc định: import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false2.

const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>31##

Đã thêm vào: V15.6.0

  • Trả lại: | Trả về một tên chủ đề khớp với const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string95 hoặc const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();04 nếu không có tên chủ đề nào khớp với const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string95.
  • const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>06 Mặc định: import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false2.

const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>08 Mặc định: import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false2.

const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>33##

Đã thêm vào: V15.6.0

  • Trả lại: | Trả về một tên chủ đề khớp với const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string95 hoặc const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();04 nếu không có tên chủ đề nào khớp với const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string95.

Kiểm tra xem chứng chỉ có khớp với tên máy chủ đã cho hay không.

Nếu chứng chỉ khớp với tên máy chủ đã cho, tên chủ đề phù hợp được trả về. Tên được trả về có thể là một kết hợp chính xác (ví dụ: const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>13) hoặc nó có thể chứa các ký tự đại diện (ví dụ: const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>14). Bởi vì so sánh tên máy chủ không phân biệt trường hợp, tên chủ đề được trả lại cũng có thể khác với const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string95 đã cho trong vốn hóa.

const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>34##

Đã thêm vào: V15.6.0

  • Trả lại: | Trả về một tên chủ đề khớp với const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string95 hoặc const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();04 nếu không có tên chủ đề nào khớp với const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string95.

Kiểm tra xem chứng chỉ có khớp với tên máy chủ đã cho hay không.

const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>36##

Nếu chứng chỉ khớp với tên máy chủ đã cho, tên chủ đề phù hợp được trả về. Tên được trả về có thể là một kết hợp chính xác (ví dụ: const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>13) hoặc nó có thể chứa các ký tự đại diện (ví dụ: const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>14). Bởi vì so sánh tên máy chủ không phân biệt trường hợp, tên chủ đề được trả lại cũng có thể khác với const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string95 đã cho trong vốn hóa.

  • Trả lại: | Trả về một tên chủ đề khớp với const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string95 hoặc const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();04 nếu không có tên chủ đề nào khớp với const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string95.

Kiểm tra xem chứng chỉ có khớp với tên máy chủ đã cho hay không.

Nếu chứng chỉ khớp với tên máy chủ đã cho, tên chủ đề phù hợp được trả về. Tên được trả về có thể là một kết hợp chính xác (ví dụ: const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>13) hoặc nó có thể chứa các ký tự đại diện (ví dụ: const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>14). Bởi vì so sánh tên máy chủ không phân biệt trường hợp, tên chủ đề được trả lại cũng có thể khác với const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string95 đã cho trong vốn hóa.

const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>38##

  • Trả lại: | Trả về một tên chủ đề khớp với const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string95 hoặc const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();04 nếu không có tên chủ đề nào khớp với const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string95.

Kiểm tra xem chứng chỉ có khớp với tên máy chủ đã cho hay không.

Nếu chứng chỉ khớp với tên máy chủ đã cho, tên chủ đề phù hợp được trả về. Tên được trả về có thể là một kết hợp chính xác (ví dụ: const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>13) hoặc nó có thể chứa các ký tự đại diện (ví dụ: const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>14). Bởi vì so sánh tên máy chủ không phân biệt trường hợp, tên chủ đề được trả lại cũng có thể khác với const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string95 đã cho trong vốn hóa.

Sau khi tiền tố biểu thị phương thức truy cập và loại vị trí truy cập, phần còn lại của mỗi dòng có thể được đặt trong các trích dẫn để chỉ ra rằng giá trị là một chuỗi JSON theo nghĩa đen. Để tương thích ngược, Node.js chỉ sử dụng các chuỗi JSON trong thuộc tính này khi cần thiết để tránh sự mơ hồ. Mã của bên thứ ba nên được chuẩn bị để xử lý cả hai định dạng nhập có thể.

const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>39##

Đã thêm vào: V15.6.0

  • Loại hình:

Nhận dạng nhà phát hành bao gồm trong chứng chỉ này.

const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>40##

Đã thêm vào: V15.9.0

  • Loại hình:

Giấy chứng nhận phát hành hoặc const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();04 nếu chứng chỉ của tổ chức phát hành không có sẵn.

const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>42##

Đã thêm vào: V15.6.0

  • Loại hình:

Nhận dạng nhà phát hành bao gồm trong chứng chỉ này.

const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>43##

Đã thêm vào: V15.6.0

  • Loại hình:

Nhận dạng nhà phát hành bao gồm trong chứng chỉ này.

const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>44##

Đã thêm vào: V15.6.0

  • Loại hình:

Nhận dạng nhà phát hành bao gồm trong chứng chỉ này.

const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>46##

Đã thêm vào: V15.6.0

  • Loại hình:

Nhận dạng nhà phát hành bao gồm trong chứng chỉ này.

Đã thêm vào: V15.9.0

const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>48##

Đã thêm vào: V15.6.0

  • Loại hình:

Nhận dạng nhà phát hành bao gồm trong chứng chỉ này.

const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>49##

  • Loại hình:

Đã thêm vào: V15.9.0

Loại hình:

Giấy chứng nhận phát hành hoặc const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();04 nếu chứng chỉ của tổ chức phát hành không có sẵn.

Một mảng chi tiết các cách sử dụng chính cho chứng chỉ này.

const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>51##

Đã thêm vào: V15.6.0

  • Loại hình:

Chìa khóa công khai cho chứng chỉ này.

const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>53##

Đã thêm vào: V15.6.0

  • Loại hình:

A let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }32 chứa mã hóa DER của chứng chỉ này.

const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>54##

Đã thêm vào: V15.6.0

  • Loại hình:

Số sê -ri của chứng chỉ này.

const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>55##

Đã thêm vào: V15.6.0

  • Loại hình:

Số sê -ri được chỉ định bởi các cơ quan chứng chỉ và không xác định duy nhất các chứng chỉ. Thay vào đó, hãy xem xét sử dụng const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>34 như một định danh duy nhất.

const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>56##

Đã thêm vào: V15.6.0

  • Loại hình:

Chủ đề hoàn chỉnh của chứng chỉ này.

const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>57##

Đã thêm vào: V15.6.0

  • Tên thay thế chủ đề được chỉ định cho chứng chỉ này.
  • Đây là một danh sách phân tách dấu phẩy của các tên thay thế chủ đề. Mỗi mục bắt đầu với một chuỗi xác định loại tên thay thế chủ đề theo sau là dấu hai chấm và giá trị liên quan đến mục nhập.

Các phiên bản trước của Node.js giả định không chính xác rằng việc chia thuộc tính này là an toàn ở chuỗi hai ký tự const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>50 (xem CVE-2021-44532). Tuy nhiên, cả chứng chỉ độc hại và hợp pháp có thể chứa các tên thay thế chủ đề bao gồm chuỗi này khi được biểu diễn dưới dạng chuỗi.

Sau khi tiền tố biểu thị loại mục nhập, phần còn lại của mỗi mục có thể được đặt trong các trích dẫn để chỉ ra rằng giá trị là một chuỗi JSON theo nghĩa đen. Để tương thích ngược, Node.js chỉ sử dụng các chuỗi JSON trong thuộc tính này khi cần thiết để tránh sự mơ hồ. Mã của bên thứ ba nên được chuẩn bị để xử lý cả hai định dạng nhập có thể.#

const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>60##

Không có mã hóa JSON tiêu chuẩn cho chứng chỉ X509. Phương thức const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>52 Trả về một chuỗi chứa chứng chỉ được mã hóa PEM.

  • Trả về thông tin về chứng chỉ này bằng cách sử dụng mã hóa đối tượng Chứng chỉ Legacy.

Trả về chứng chỉ được mã hóa PEM.

const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>61##

Ngày/giờ mà chứng chỉ này được coi là hợp lệ.Deprecated since: v10.0.0

Ngày/giờ cho đến khi chứng chỉ này được coi là hợp lệ.

const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string48 Một khóa công khai.

Trả lại:

Xác minh rằng chứng chỉ này đã được ký bởi khóa công khai đã cho. Không thực hiện bất kỳ kiểm tra xác thực nào khác trên chứng chỉ.

const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>67##

const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();1 Phương thức và thuộc tính mô -đun#Deprecated since: v10.0.0

Đã thêm vào: v6.3.0

This property is deprecated. Please use const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>68 and const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>69 instead.

const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>70##

  • Một đối tượng chứa các hằng số thường được sử dụng cho các hoạt động liên quan đến tiền điện tử và bảo mật. Các hằng số cụ thể hiện được xác định được mô tả trong hằng số tiền điện tử.
  • Đã thêm vào: v0.9.3deprecated kể từ: v10.0.0
    • Mã hóa mặc định để sử dụng cho các chức năng có thể lấy chuỗi hoặc bộ đệm. Giá trị mặc định là const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();09, làm cho các phương thức mặc định thành các đối tượng let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }32.Default: const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>74
  • Cơ chế const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>61 được cung cấp để tương thích ngược với các chương trình cũ dự kiến ​​const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>65 sẽ là mã hóa mặc định.
    • Các ứng dụng mới sẽ hy vọng mặc định là const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();09.
    • Tài sản này không được dùng cho.

Kiểm tra tính nguyên thủy của const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>71.

const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>84##

Đã thêm vào: V15.8.0

  • const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>71 | | | | | Một nguyên tố có thể được mã hóa như một chuỗi các octet endian lớn có độ dài tùy ý.
  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }50
    • const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>73 Số lần lặp nguyên thủy xác suất Miller-Rabin để thực hiện. Khi giá trị là const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>74 (0), một số kiểm tra được sử dụng mang lại tỷ lệ dương tính giả là tối đa 2-64 cho đầu vào ngẫu nhiên. Phải cẩn thận khi chọn một số séc. Tham khảo tài liệu OpenSSL cho chức năng const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>75 const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>76 Tùy chọn để biết thêm chi tiết. Mặc định: const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>74Default: const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>74
  • Trả về: import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false0 Nếu ứng viên là số chính có xác suất lỗi nhỏ hơn const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>82.

Kiểm tra tính nguyên thủy của const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>71.

const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>95##

  • const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>96
  • const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>97 | | | |
  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }50 let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }51 Tùy chọn
  • Trả lại:

Tạo và trả về một đối tượng let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }15 sử dụng const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>96 và const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>97 đã cho.

Đối số let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }50 kiểm soát hành vi luồng và là tùy chọn trừ khi một mật mã trong chế độ CCM hoặc OCB (ví dụ: import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false04) được sử dụng. Trong trường hợp đó, tùy chọn let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }45 là bắt buộc và chỉ định độ dài của thẻ xác thực trong byte, xem chế độ CCM. Trong chế độ GCM, tùy chọn let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }45 không bắt buộc nhưng có thể được sử dụng để đặt độ dài của thẻ xác thực sẽ được trả về bởi import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false07 và mặc định thành 16 byte. Đối với let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }40, tùy chọn let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }45 mặc định là 16 byte.

const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>96 phụ thuộc vào OpenSSL, các ví dụ là import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false11, v.v. trên các bản phát hành OpenSSL gần đây, import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false12 sẽ hiển thị các thuật toán mã hóa có sẵn.

const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>97 được sử dụng để lấy phím mật mã và vectơ khởi tạo (IV). Giá trị phải là chuỗi được mã hóa const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>65, A let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }32, let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }88 hoặc let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }89.

Chức năng này không an toàn về mặt ngữ nghĩa cho tất cả các mật mã được hỗ trợ và thiếu sót nghiêm trọng đối với các mật mã ở chế độ truy cập (như CTR, GCM hoặc CCM).

Việc triển khai let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }19 có các khóa sử dụng hàm openSSL import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false19 với thuật toán tiêu hóa được đặt thành MD5, một lần lặp và không có muối. Việc thiếu muối cho phép các cuộc tấn công từ điển vì cùng một mật khẩu luôn tạo ra cùng một khóa. Số lần lặp thấp và thuật toán băm không an toàn về mặt văn bản cho phép mật khẩu được kiểm tra rất nhanh.

Theo khuyến nghị của OpenSSL là sử dụng thuật toán hiện đại hơn thay vì import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false19, các nhà phát triển nên tự mình lấy khóa và IV bằng cách sử dụng import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false21 và sử dụng let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }20 để tạo đối tượng let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }15. Người dùng không nên sử dụng mật mã với chế độ truy cập (ví dụ: CTR, GCM hoặc CCM) trong let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }19. Một cảnh báo được phát ra khi chúng được sử dụng để tránh nguy cơ tái sử dụng IV gây ra lỗ hổng. Đối với trường hợp khi IV được tái sử dụng trong GCM, hãy xem các đối thủ không tôn trọng để biết chi tiết.

import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false25##

  • const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>96
  • const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>97 | | | |
  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }50 let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }51 Tùy chọn
  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }50 let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }51 Tùy chọn
  • Trả lại:

Tạo và trả về một đối tượng let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }15 sử dụng const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>96 và const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>97 đã cho.

Đối số let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }50 kiểm soát hành vi luồng và là tùy chọn trừ khi một mật mã trong chế độ CCM hoặc OCB (ví dụ: import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false04) được sử dụng. Trong trường hợp đó, tùy chọn let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }45 là bắt buộc và chỉ định độ dài của thẻ xác thực trong byte, xem chế độ CCM. Trong chế độ GCM, tùy chọn let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }45 không bắt buộc nhưng có thể được sử dụng để đặt độ dài của thẻ xác thực sẽ được trả về bởi import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false07 và mặc định thành 16 byte. Đối với let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }40, tùy chọn let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }45 mặc định là 16 byte.

const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>96 phụ thuộc vào OpenSSL, các ví dụ là import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false11, v.v. trên các bản phát hành OpenSSL gần đây, import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false12 sẽ hiển thị các thuật toán mã hóa có sẵn.

const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>97 được sử dụng để lấy phím mật mã và vectơ khởi tạo (IV). Giá trị phải là chuỗi được mã hóa const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>65, A let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }32, let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }88 hoặc let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }89.

Chức năng này không an toàn về mặt ngữ nghĩa cho tất cả các mật mã được hỗ trợ và thiếu sót nghiêm trọng đối với các mật mã ở chế độ truy cập (như CTR, GCM hoặc CCM).

Việc triển khai let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }19 có các khóa sử dụng hàm openSSL import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false19 với thuật toán tiêu hóa được đặt thành MD5, một lần lặp và không có muối. Việc thiếu muối cho phép các cuộc tấn công từ điển vì cùng một mật khẩu luôn tạo ra cùng một khóa. Số lần lặp thấp và thuật toán băm không an toàn về mặt văn bản cho phép mật khẩu được kiểm tra rất nhanh.

import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false58##

  • const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>96
  • const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>97 | | | |
  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }50 let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }51 Tùy chọn
  • Trả lại:

Tạo và trả về một đối tượng let crypto; try { crypto = await import('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }03 sử dụng const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>96 và const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>97 (khóa) đã cho.

Đối số let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }50 kiểm soát hành vi luồng và là tùy chọn trừ khi một mật mã trong chế độ CCM hoặc OCB (ví dụ: import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false04) được sử dụng. Trong trường hợp đó, tùy chọn let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }45 là bắt buộc và chỉ định độ dài của thẻ xác thực trong byte, xem chế độ CCM. Đối với let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }40, tùy chọn let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }45 mặc định là 16 byte.

Chức năng này không an toàn về mặt ngữ nghĩa cho tất cả các mật mã được hỗ trợ và thiếu sót nghiêm trọng đối với các mật mã ở chế độ truy cập (như CTR, GCM hoặc CCM).

Việc triển khai let crypto; try { crypto = await import('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }07 có các khóa sử dụng hàm openSSL import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false19 với thuật toán tiêu hóa được đặt thành MD5, một lần lặp và không có muối. Việc thiếu muối cho phép các cuộc tấn công từ điển vì cùng một mật khẩu luôn tạo ra cùng một khóa. Số lần lặp thấp và thuật toán băm không an toàn về mặt văn bản cho phép mật khẩu được kiểm tra rất nhanh.

Theo khuyến nghị của OpenSSL là sử dụng thuật toán hiện đại hơn thay vì import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false19, các nhà phát triển nên tự mình lấy khóa và IV bằng cách sử dụng import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false21 và sử dụng let crypto; try { crypto = await import('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }08 để tạo đối tượng let crypto; try { crypto = await import('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }03.

import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false77##

  • const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>96
  • const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string83 | | | | | |
  • import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false28 | | | | |
  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }50 let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }51 Tùy chọn
  • Trả lại:

Tạo và trả về một đối tượng let crypto; try { crypto = await import('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }03 sử dụng const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>96 và const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>97 (khóa) đã cho.

Đối số let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }50 kiểm soát hành vi luồng và là tùy chọn trừ khi một mật mã trong chế độ CCM hoặc OCB (ví dụ: import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false04) được sử dụng. Trong trường hợp đó, tùy chọn let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }45 là bắt buộc và chỉ định độ dài của thẻ xác thực trong byte, xem chế độ CCM. Đối với let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }40, tùy chọn let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }45 mặc định là 16 byte.

Chức năng này không an toàn về mặt ngữ nghĩa cho tất cả các mật mã được hỗ trợ và thiếu sót nghiêm trọng đối với các mật mã ở chế độ truy cập (như CTR, GCM hoặc CCM).

Việc triển khai let crypto; try { crypto = await import('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }07 có các khóa sử dụng hàm openSSL import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false19 với thuật toán tiêu hóa được đặt thành MD5, một lần lặp và không có muối. Việc thiếu muối cho phép các cuộc tấn công từ điển vì cùng một mật khẩu luôn tạo ra cùng một khóa. Số lần lặp thấp và thuật toán băm không an toàn về mặt văn bản cho phép mật khẩu được kiểm tra rất nhanh.

Theo khuyến nghị của OpenSSL là sử dụng thuật toán hiện đại hơn thay vì import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false19, các nhà phát triển nên tự mình lấy khóa và IV bằng cách sử dụng import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false21 và sử dụng let crypto; try { crypto = await import('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }08 để tạo đối tượng let crypto; try { crypto = await import('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }03.

const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>96

let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }009##

  • const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string83 | | | | | |
  • import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false28 | | | | |
  • Trả lại:Default: let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }014
  • Tạo và trả về một đối tượng let crypto; try { crypto = await import('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }03 sử dụng vector const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>96, const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string83 và khởi tạo (import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false28) đã cho.
  • Trả lại:

Tạo và trả về một đối tượng let crypto; try { crypto = await import('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }03 sử dụng const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>96 và const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>97 (khóa) đã cho.

Đối số let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }50 kiểm soát hành vi luồng và là tùy chọn trừ khi một mật mã trong chế độ CCM hoặc OCB (ví dụ: import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false04) được sử dụng. Trong trường hợp đó, tùy chọn let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }45 là bắt buộc và chỉ định độ dài của thẻ xác thực trong byte, xem chế độ CCM. Đối với let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }40, tùy chọn let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }45 mặc định là 16 byte.

Chức năng này không an toàn về mặt ngữ nghĩa cho tất cả các mật mã được hỗ trợ và thiếu sót nghiêm trọng đối với các mật mã ở chế độ truy cập (như CTR, GCM hoặc CCM).

Việc triển khai let crypto; try { crypto = await import('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }07 có các khóa sử dụng hàm openSSL import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false19 với thuật toán tiêu hóa được đặt thành MD5, một lần lặp và không có muối. Việc thiếu muối cho phép các cuộc tấn công từ điển vì cùng một mật khẩu luôn tạo ra cùng một khóa. Số lần lặp thấp và thuật toán băm không an toàn về mặt văn bản cho phép mật khẩu được kiểm tra rất nhanh.

let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }034##

Theo khuyến nghị của OpenSSL là sử dụng thuật toán hiện đại hơn thay vì import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false19, các nhà phát triển nên tự mình lấy khóa và IV bằng cách sử dụng import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false21 và sử dụng let crypto; try { crypto = await import('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }08 để tạo đối tượng let crypto; try { crypto = await import('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }03.

  • const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>96
  • const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string83 | | | | | |Default: let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }014
  • Trả lại:

Tạo và trả về một đối tượng let crypto; try { crypto = await import('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }03 sử dụng const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>96 và const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>97 (khóa) đã cho.

let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }043##

Đối số let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }50 kiểm soát hành vi luồng và là tùy chọn trừ khi một mật mã trong chế độ CCM hoặc OCB (ví dụ: import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false04) được sử dụng. Trong trường hợp đó, tùy chọn let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }45 là bắt buộc và chỉ định độ dài của thẻ xác thực trong byte, xem chế độ CCM. Đối với let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }40, tùy chọn let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }45 mặc định là 16 byte.

  • Chức năng này không an toàn về mặt ngữ nghĩa cho tất cả các mật mã được hỗ trợ và thiếu sót nghiêm trọng đối với các mật mã ở chế độ truy cập (như CTR, GCM hoặc CCM).
  • Trả lại:

Tạo và trả về một đối tượng let crypto; try { crypto = await import('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }03 sử dụng const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>96 và const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>97 (khóa) đã cho.

let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }046##

Đối số let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }50 kiểm soát hành vi luồng và là tùy chọn trừ khi một mật mã trong chế độ CCM hoặc OCB (ví dụ: import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false04) được sử dụng. Trong trường hợp đó, tùy chọn let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }45 là bắt buộc và chỉ định độ dài của thẻ xác thực trong byte, xem chế độ CCM. Đối với let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }40, tùy chọn let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }45 mặc định là 16 byte.

  • Chức năng này không an toàn về mặt ngữ nghĩa cho tất cả các mật mã được hỗ trợ và thiếu sót nghiêm trọng đối với các mật mã ở chế độ truy cập (như CTR, GCM hoặc CCM).
  • Trả lại:

Tạo và trả về một đối tượng let crypto; try { crypto = await import('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }03 sử dụng const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>96 và const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>97 (khóa) đã cho.

let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }052##

  • const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>96
  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }50 let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }51 Tùy chọn
  • Trả lại:

Tạo và trả về một đối tượng const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>84 có thể được sử dụng để tạo các tiêu hóa băm bằng cách sử dụng const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>96 đã cho. let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }50 đối số kiểm soát hành vi luồng. Đối với các hàm băm XOF như import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false02, tùy chọn import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false03 có thể được sử dụng để chỉ định độ dài đầu ra mong muốn tính bằng byte.

const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>96 phụ thuộc vào các thuật toán có sẵn được hỗ trợ bởi phiên bản OpenSSL trên nền tảng. Các ví dụ là let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }062, let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }063, v.v. trên các bản phát hành gần đây của OpenSSL, let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }064 sẽ hiển thị các thuật toán tiêu hóa có sẵn.

Ví dụ: Tạo tổng Sha256 của tệp

const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string2

let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }065##

  • const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>96
  • const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string83 | | | | | |
  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }50 let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }51 Tùy chọn
    • const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string8 Mã hóa chuỗi để sử dụng khi const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string83 là một chuỗi.
  • Trả lại:

Tạo và trả về một đối tượng import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false27 sử dụng const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>96 và const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string83 đã cho. let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }50 đối số kiểm soát hành vi luồng.

const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>96 phụ thuộc vào các thuật toán có sẵn được hỗ trợ bởi phiên bản OpenSSL trên nền tảng. Các ví dụ là let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }062, let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }063, v.v. trên các bản phát hành gần đây của OpenSSL, let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }064 sẽ hiển thị các thuật toán tiêu hóa có sẵn.

Ví dụ: Tạo tổng Sha256 của tệp

const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>96

const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string3

let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }083##

  • const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string83 | | | | | |
    • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }50 let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }51 Tùy chọn
    • const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string8 Mã hóa chuỗi để sử dụng khi const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string83 là một chuỗi.Default: const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();15.
    • Trả lại:
    • Tạo và trả về một đối tượng import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false27 sử dụng const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>96 và const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string83 đã cho. let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }50 đối số kiểm soát hành vi luồng.
    • const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string83 là khóa HMAC được sử dụng để tạo băm HMAC mật mã. Nếu đó là import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false62, loại của nó phải là import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false53.
  • Trả lại:

Tạo và trả về một đối tượng import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false27 sử dụng const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>96 và const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string83 đã cho. let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }50 đối số kiểm soát hành vi luồng.

const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string83 là khóa HMAC được sử dụng để tạo băm HMAC mật mã. Nếu đó là import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false62, loại của nó phải là import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false53.

let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }106##

  • const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string83 | | | | | |
    • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }50 let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }51 Tùy chọn
    • const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string8 Mã hóa chuỗi để sử dụng khi const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string83 là một chuỗi.Default: const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();15.
    • Trả lại:
    • const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string8 Mã hóa chuỗi để sử dụng khi const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string83 là một chuỗi.
  • Trả lại:

Tạo và trả về một đối tượng import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false27 sử dụng const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>96 và const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string83 đã cho. let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }50 đối số kiểm soát hành vi luồng.

const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string83 là khóa HMAC được sử dụng để tạo băm HMAC mật mã. Nếu đó là import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false62, loại của nó phải là import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false53.

Ví dụ: Tạo HMAC SHA256 của tệp

let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }139##

  • const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string83 | | | | |
  • const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string83: | | | | | Vật liệu chính, ở định dạng PEM, DER hoặc JWK.
  • Trả lại:

Tạo và trả về một đối tượng import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false27 sử dụng const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>96 và const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string83 đã cho. let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }50 đối số kiểm soát hành vi luồng.

let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }144##

const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string83 là khóa HMAC được sử dụng để tạo băm HMAC mật mã. Nếu đó là import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false62, loại của nó phải là import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false53.

  • const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>96
  • Ví dụ: Tạo HMAC SHA256 của tệp
  • Trả lại:

Tạo và trả về một đối tượng import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false27 sử dụng const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>96 và const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string83 đã cho. let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }50 đối số kiểm soát hành vi luồng.

const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string83 là khóa HMAC được sử dụng để tạo băm HMAC mật mã. Nếu đó là import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false62, loại của nó phải là import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false53.

let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }156##

const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string83 là khóa HMAC được sử dụng để tạo băm HMAC mật mã. Nếu đó là import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false62, loại của nó phải là import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false53.

  • const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>96
  • Ví dụ: Tạo HMAC SHA256 của tệp
  • Trả lại:

Tạo và trả về một đối tượng import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false27 sử dụng const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>96 và const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string83 đã cho. let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }50 đối số kiểm soát hành vi luồng.

Trong một số trường hợp, một trường hợp const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();61 có thể được tạo bằng cách sử dụng tên của thuật toán chữ ký, chẳng hạn như let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }154, thay vì thuật toán tiêu hóa. Điều này sẽ sử dụng thuật toán tiêu hóa tương ứng. Điều này không hoạt động cho tất cả các thuật toán chữ ký, chẳng hạn như let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }155, vì vậy tốt nhất là luôn luôn sử dụng tên thuật toán Digest.

let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }167##

Đã thêm vào: v13.9.0, v12.17.0

  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }50:
    • const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string37:
    • const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string48:
  • Trả lại:

Tính toán bí mật Diffie-Hellman dựa trên const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string37 và const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string48. Cả hai khóa phải có cùng let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }173, phải là một trong số const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();03 (đối với Diffie-Hellman), import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false98 (đối với ECDH), const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();00 hoặc import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false99 (đối với ECDH-ES).

let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }178##

  • const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();11: Việc sử dụng dự định của khóa bí mật được tạo. Các giá trị hiện được chấp nhận là let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }180 và let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }181.
  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }50:
    • const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string37:
      • const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string48:
      • Trả lại:
  • Tính toán bí mật Diffie-Hellman dựa trên const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string37 và const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string48. Cả hai khóa phải có cùng let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }173, phải là một trong số const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();03 (đối với Diffie-Hellman), import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false98 (đối với ECDH), const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();00 hoặc import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false99 (đối với ECDH-ES).
    • const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();11: Việc sử dụng dự định của khóa bí mật được tạo. Các giá trị hiện được chấp nhận là let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }180 và let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }181.
    • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }183: Độ dài bit của phím để tạo. Đây phải là một giá trị lớn hơn 0.

Nếu const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();11 là let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }180, mức tối thiểu là 8 và chiều dài tối đa là 231-1. Nếu giá trị không phải là bội số của 8, khóa được tạo sẽ bị cắt giảm thành let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }186.

const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string4

let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }198##

  • Nếu const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();11 là let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }181, độ dài phải là một trong số let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }189, let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }190 hoặc let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }191.
  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }50:
    • const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string37:
    • const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string48:Default: let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }212.
    • Trả lại:
    • Tính toán bí mật Diffie-Hellman dựa trên const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string37 và const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string48. Cả hai khóa phải có cùng let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }173, phải là một trong số const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();03 (đối với Diffie-Hellman), import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false98 (đối với ECDH), const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();00 hoặc import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false99 (đối với ECDH-ES).
    • const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();11: Việc sử dụng dự định của khóa bí mật được tạo. Các giá trị hiện được chấp nhận là let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }180 và let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }181.
    • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }183: Độ dài bit của phím để tạo. Đây phải là một giá trị lớn hơn 0.
    • Nếu const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();11 là let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }180, mức tối thiểu là 8 và chiều dài tối đa là 231-1. Nếu giá trị không phải là bội số của 8, khóa được tạo sẽ bị cắt giảm thành let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }186.
    • Nếu const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();11 là let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }181, độ dài phải là một trong số let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }189, let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }190 hoặc let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }191.
    • const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>78:
    • const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>79:Default: let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }014.
    • const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string83:
    • Không đồng bộ tạo ra một khóa bí mật ngẫu nhiên mới của let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }183 đã cho. const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();11 sẽ xác định xác nhận nào sẽ được thực hiện trên let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }183.
    • const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();11: Phải là import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false95, import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false96, import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false97, import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false98, const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();01, const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();02, import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false99, const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();00 hoặc const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();03.
  • Tính toán bí mật Diffie-Hellman dựa trên const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string37 và const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string48. Cả hai khóa phải có cùng let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }173, phải là một trong số const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();03 (đối với Diffie-Hellman), import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false98 (đối với ECDH), const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();00 hoặc import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false99 (đối với ECDH-ES).
    • const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();11: Việc sử dụng dự định của khóa bí mật được tạo. Các giá trị hiện được chấp nhận là let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }180 và let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }181.
    • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }183: Độ dài bit của phím để tạo. Đây phải là một giá trị lớn hơn 0.
    • Nếu const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();11 là let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }180, mức tối thiểu là 8 và chiều dài tối đa là 231-1. Nếu giá trị không phải là bội số của 8, khóa được tạo sẽ bị cắt giảm thành let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }186.

Nếu const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();11 là let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }181, độ dài phải là một trong số let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }189, let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }190 hoặc let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }191.

const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>78:

const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>79:

const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string5

const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string83:

Không đồng bộ tạo ra một khóa bí mật ngẫu nhiên mới của let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }183 đã cho. const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();11 sẽ xác định xác nhận nào sẽ được thực hiện trên let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }183.

let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }250##

  • Nếu const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();11 là let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }181, độ dài phải là một trong số let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }189, let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }190 hoặc let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }191.
  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }50:
    • const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string37:
    • const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string48:Default: let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }212.
    • Trả lại:
    • Tính toán bí mật Diffie-Hellman dựa trên const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string37 và const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string48. Cả hai khóa phải có cùng let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }173, phải là một trong số const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();03 (đối với Diffie-Hellman), import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false98 (đối với ECDH), const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();00 hoặc import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false99 (đối với ECDH-ES).
    • const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();11: Việc sử dụng dự định của khóa bí mật được tạo. Các giá trị hiện được chấp nhận là let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }180 và let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }181.
    • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }183: Độ dài bit của phím để tạo. Đây phải là một giá trị lớn hơn 0.
    • Nếu const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();11 là let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }180, mức tối thiểu là 8 và chiều dài tối đa là 231-1. Nếu giá trị không phải là bội số của 8, khóa được tạo sẽ bị cắt giảm thành let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }186.
    • Nếu const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();11 là let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }181, độ dài phải là một trong số let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }189, let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }190 hoặc let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }191.
    • const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>78:
    • const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>79:Default: let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }014.
    • const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string83:
    • Không đồng bộ tạo ra một khóa bí mật ngẫu nhiên mới của let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }183 đã cho. const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();11 sẽ xác định xác nhận nào sẽ được thực hiện trên let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }183.
    • const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();11: Phải là import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false95, import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false96, import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false97, import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false98, const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();01, const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();02, import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false99, const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();00 hoặc const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();03.
  • import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false82: Kích thước khóa tính bằng bit (RSA, DSA).
    • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }183: Độ dài bit của phím để tạo. Đây phải là một giá trị lớn hơn 0.
    • Nếu const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();11 là let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }180, mức tối thiểu là 8 và chiều dài tối đa là 231-1. Nếu giá trị không phải là bội số của 8, khóa được tạo sẽ bị cắt giảm thành let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }186.

Nếu const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();11 là let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }181, độ dài phải là một trong số let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }189, let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }190 hoặc let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }191.

const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>78:

const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>79:

const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string6

const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string83:

let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }291##

Đã thêm vào: v15.0.0

  • const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();11: Việc sử dụng dự định của khóa bí mật được tạo. Các giá trị hiện được chấp nhận là let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }180 và let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }181.
  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }50:
    • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }183: Độ dài bit của phím để tạo.
      • Nếu const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();11 là let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }180, mức tối thiểu là 8 và chiều dài tối đa là 231-1. Nếu giá trị không phải là bội số của 8, khóa được tạo sẽ bị cắt giảm thành let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }186.
      • Nếu const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();11 là let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }181, độ dài phải là một trong số let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }189, let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }190 hoặc let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }191.
  • Trả lại:

Đồng bộ tạo ra một khóa bí mật ngẫu nhiên mới của let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }183 đã cho. const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();11 sẽ xác định xác nhận nào sẽ được thực hiện trên let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }183.

const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string7

let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }308##

  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }309 Kích thước (tính bằng bit) của số nguyên tố để tạo.
  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }50
    • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }311 | | | | |
    • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }312 | | | | |
    • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }313 Mặc định: import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false2.Default: import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false2.
    • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }315 Khi import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false0, nguyên tố được tạo được trả về dưới dạng let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }315.
  • const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>78
    • const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>79
    • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }010 |

Tạo ra một nguyên tố giả của let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }309 bit.

Nếu let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }322 là import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false0, Prime sẽ là một nguyên tố an toàn - nghĩa là, let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }324 cũng sẽ là một chính.

Các tham số let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }325 và let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }326 có thể được sử dụng để thực thi các yêu cầu bổ sung, ví dụ: đối với Diffie-Hellman:

  • Nếu let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }325 và let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }326 đều được đặt, Prime sẽ đáp ứng điều kiện mà let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }329.
  • Nếu chỉ let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }325 được đặt và let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }322 không phải là import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false0, thì Prime sẽ đáp ứng điều kiện mà let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }333.
  • Nếu chỉ let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }325 được đặt và let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }322 được đặt thành import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false0, thì nguyên tố thay vào đó sẽ đáp ứng điều kiện mà let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }337. Điều này là cần thiết bởi vì let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }333 cho let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }339 sẽ mâu thuẫn với điều kiện được thi hành bởi let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }322.
  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }326 bị bỏ qua nếu let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }325 không được đưa ra.

Cả let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }325 và let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }326 phải được mã hóa dưới dạng các chuỗi lớn hơn nếu được đưa ra dưới dạng let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }345, let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }346, let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }88, let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }32 hoặc let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }89.

Theo mặc định, Prime được mã hóa dưới dạng một chuỗi octet lớn trong một. Nếu tùy chọn let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }315 là import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false0, thì A được cung cấp.

let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }352##

Đã thêm vào: V15.8.0

  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }309 Kích thước (tính bằng bit) của số nguyên tố để tạo.
  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }50
    • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }311 | | | | |
    • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }312 | | | | |
    • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }313 Mặc định: import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false2.Default: import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false2.
    • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }315 Khi import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false0, nguyên tố được tạo được trả về dưới dạng let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }315.
  • const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>78

Tạo ra một nguyên tố giả của let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }309 bit.

Nếu let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }322 là import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false0, Prime sẽ là một nguyên tố an toàn - nghĩa là, let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }324 cũng sẽ là một chính.

Các tham số let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }325 và let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }326 có thể được sử dụng để thực thi các yêu cầu bổ sung, ví dụ: đối với Diffie-Hellman:

  • Nếu let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }325 và let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }326 đều được đặt, Prime sẽ đáp ứng điều kiện mà let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }329.
  • Nếu chỉ let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }325 được đặt và let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }322 không phải là import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false0, thì Prime sẽ đáp ứng điều kiện mà let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }333.
  • Nếu chỉ let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }325 được đặt và let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }322 được đặt thành import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false0, thì nguyên tố thay vào đó sẽ đáp ứng điều kiện mà let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }337. Điều này là cần thiết bởi vì let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }333 cho let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }339 sẽ mâu thuẫn với điều kiện được thi hành bởi let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }322.
  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }326 bị bỏ qua nếu let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }325 không được đưa ra.

Cả let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }325 và let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }326 phải được mã hóa dưới dạng các chuỗi lớn hơn nếu được đưa ra dưới dạng let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }345, let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }346, let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }88, let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }32 hoặc let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }89.

Theo mặc định, Prime được mã hóa dưới dạng một chuỗi octet lớn trong một. Nếu tùy chọn let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }315 là import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false0, thì A được cung cấp.

let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }393##

Đã thêm vào: v15.0.0

  • Đã thêm vào: V15.8.0
  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }50:
    • Trả lại: |
    • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }394: | Tên hoặc số lượng của mật mã để truy vấn.
  • Trả lại:
    • Đồng bộ tạo ra một khóa bí mật ngẫu nhiên mới của let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }183 đã cho. const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();11 sẽ xác định xác nhận nào sẽ được thực hiện trên let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }183.
    • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }309 Kích thước (tính bằng bit) của số nguyên tố để tạo.
    • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }50
    • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }311 | | | | |
    • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }312 | | | | |
    • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }313 Mặc định: import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false2.

let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }315 Khi import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false0, nguyên tố được tạo được trả về dưới dạng let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }315.

const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>78

let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }421##

Đã thêm vào: V0.9.3

  • Trả về: Một mảng có tên của các thuật toán mật mã được hỗ trợ.
const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string8

const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string99##

Đã thêm vào: V2.3.0

  • Trả về: Một mảng có tên của các đường cong elip được hỗ trợ.
const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string9

let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }423##

Đã thêm vào: V0.7.5

  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }223
  • Trả lại:

Tạo một đối tượng trao đổi khóa const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string65 được xác định trước. Các nhóm được hỗ trợ được liệt kê trong tài liệu cho const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string65.

Đối tượng được trả về bắt chước giao diện của các đối tượng được tạo bởi let crypto; try { crypto = await import('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }95, nhưng sẽ không cho phép thay đổi các phím (ví dụ với let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }428). Ưu điểm của việc sử dụng phương pháp này là các bên không phải tạo ra cũng không trao đổi mô đun nhóm trước, tiết kiệm cả bộ xử lý và thời gian giao tiếp.

Ví dụ (có được một bí mật chia sẻ):

const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>0

const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>69##

Đã thêm vào: v10.0.0

  • Trả về: let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }430 khi và chỉ khi một nhà cung cấp tiền điện tử tuân thủ FIPS hiện đang được sử dụng, const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>74 khác. Bản phát hành Semver-Major trong tương lai có thể thay đổi loại trả về API này thành a.

let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }150##

Đã thêm vào: V0.9.3

  • Trả về: Một mảng tên của các thuật toán băm được hỗ trợ, chẳng hạn như let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }154. Các thuật toán băm cũng được gọi là thuật toán "Digest".
const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>1

let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }434##

Đã thêm vào: v17.4.0

  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }435 | | |
  • Trả lại: | | | Trả về let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }435.

Một bí danh thuận tiện cho let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }437. Việc triển khai này không tuân thủ thông số kỹ thuật tiền điện tử Web, để viết mã tương thích web let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }437 thay thế.

let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }439##

  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }440 Thuật toán tiêu hóa sẽ sử dụng.
  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }441 | | | | | Các vật liệu khóa đầu vào. Phải được cung cấp nhưng có thể có độ dài bằng không.
  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }442 | | | | Giá trị muối. Phải được cung cấp nhưng có thể có độ dài bằng không.
  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }443 | | | | Giá trị thông tin bổ sung. Phải được cung cấp nhưng có thể có độ dài bằng không và không thể nhiều hơn 1024 byte.
  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }444 Độ dài của phím để tạo. Phải lớn hơn 0. Giá trị tối đa cho phép là let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }445 lần số byte được tạo bởi hàm tiêu hóa đã chọn (ví dụ: let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }446 tạo ra băm 64 byte, tạo ra đầu ra HKDF tối đa 16320 byte).
  • const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>78
    • const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>79
    • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }449

HKDF là một hàm dẫn xuất khóa đơn giản được xác định trong RFC 5869. đã cho let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }441, let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }442 và let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }443 được sử dụng với let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }440 để lấy phím byte let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }444.

Hàm const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>78 được cung cấp được gọi với hai đối số: const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>79 và let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }449. Nếu một lỗi xảy ra trong khi rút ra khóa, const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>79 sẽ được đặt; Nếu không const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>79 sẽ là import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false55. Các let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }449 được tạo thành công sẽ được chuyển đến cuộc gọi lại dưới dạng. Một lỗi sẽ được ném nếu bất kỳ đối số đầu vào nào chỉ định các giá trị hoặc loại không hợp lệ.

const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>2

let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }462##

  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }440 Thuật toán tiêu hóa sẽ sử dụng.
  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }441 | | | | | Các vật liệu khóa đầu vào. Phải được cung cấp nhưng có thể có độ dài bằng không.
  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }442 | | | | Giá trị muối. Phải được cung cấp nhưng có thể có độ dài bằng không.
  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }443 | | | | Giá trị thông tin bổ sung. Phải được cung cấp nhưng có thể có độ dài bằng không và không thể nhiều hơn 1024 byte.
  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }444 Độ dài của phím để tạo. Phải lớn hơn 0. Giá trị tối đa cho phép là let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }445 lần số byte được tạo bởi hàm tiêu hóa đã chọn (ví dụ: let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }446 tạo ra băm 64 byte, tạo ra đầu ra HKDF tối đa 16320 byte).
  • Trả lại:

Tạo một đối tượng trao đổi khóa const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string65 được xác định trước. Các nhóm được hỗ trợ được liệt kê trong tài liệu cho const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string65.

Đối tượng được trả về bắt chước giao diện của các đối tượng được tạo bởi let crypto; try { crypto = await import('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }95, nhưng sẽ không cho phép thay đổi các phím (ví dụ với let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }428). Ưu điểm của việc sử dụng phương pháp này là các bên không phải tạo ra cũng không trao đổi mô đun nhóm trước, tiết kiệm cả bộ xử lý và thời gian giao tiếp.

Ví dụ (có được một bí mật chia sẻ):

const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>3

let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }476##

  • Đã thêm vào: v10.0.0
  • Trả về: let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }430 khi và chỉ khi một nhà cung cấp tiền điện tử tuân thủ FIPS hiện đang được sử dụng, const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>74 khác. Bản phát hành Semver-Major trong tương lai có thể thay đổi loại trả về API này thành a.
  • Trả về: Một mảng tên của các thuật toán băm được hỗ trợ, chẳng hạn như let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }154. Các thuật toán băm cũng được gọi là thuật toán "Digest".
  • Đã thêm vào: v17.4.0
  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }435 | | |
  • const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>78
    • const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>79
    • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }449

HKDF là một hàm dẫn xuất khóa đơn giản được xác định trong RFC 5869. đã cho let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }441, let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }442 và let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }443 được sử dụng với let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }440 để lấy phím byte let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }444.

Hàm const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>78 được cung cấp được gọi với hai đối số: const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>79 và let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }449. Nếu một lỗi xảy ra trong khi rút ra khóa, const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>79 sẽ được đặt; Nếu không const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>79 sẽ là import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false55. Các let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }449 được tạo thành công sẽ được chuyển đến cuộc gọi lại dưới dạng. Một lỗi sẽ được ném nếu bất kỳ đối số đầu vào nào chỉ định các giá trị hoặc loại không hợp lệ.

Cung cấp chức năng dẫn xuất khóa HKDF đồng bộ như được định nghĩa trong RFC 5869. đã cho let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }441, let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }442 và let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }443 được sử dụng với let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }440 để lấy phím let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }444 bytes.

let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }442 nên càng độc đáo càng tốt. Nên khuyến cáo rằng một muối là ngẫu nhiên và ít nhất 16 byte. Xem NIST SP 800-132 để biết chi tiết.

Khi vượt qua các chuỗi cho const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>97 hoặc let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }442, vui lòng xem xét cảnh báo khi sử dụng các chuỗi làm đầu vào cho API mật mã.

const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>4

Thuộc tính const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>61 có thể được sử dụng để thay đổi cách let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }449 được chuyển cho cuộc gọi lại. Tài sản này, tuy nhiên, đã được không dùng nữa và nên tránh sử dụng.

const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>5

Một loạt các chức năng tiêu hóa được hỗ trợ có thể được truy xuất bằng cách sử dụng let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }150.

API này sử dụng ThreadPool của Libuv, có thể có ý nghĩa hiệu suất tiêu cực và đáng ngạc nhiên đối với một số ứng dụng; Xem tài liệu let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }505 để biết thêm thông tin.

let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }506##

  • const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>97 | | |
  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }442 | | |
  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }479
  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }444
  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }440
  • Trả lại:

Cung cấp triển khai chức năng dẫn xuất khóa dựa trên mật khẩu đồng bộ 2 (PBKDF2). Một thuật toán tiêu hóa HMAC được chọn được chỉ định bởi let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }440 được áp dụng để lấy một phím của chiều dài byte được yêu cầu (let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }444) từ const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>97, let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }442 và let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }479.

Nếu xảy ra lỗi, let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }517 sẽ bị ném, nếu không, khóa dẫn xuất sẽ được trả về dưới dạng let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }32.

Đối số let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }479 phải là một số được đặt càng cao càng tốt. Số lần lặp càng cao, khóa dẫn xuất càng an toàn, nhưng sẽ mất nhiều thời gian để hoàn thành.

let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }442 nên càng độc đáo càng tốt. Nên khuyến cáo rằng một muối là ngẫu nhiên và ít nhất 16 byte. Xem NIST SP 800-132 để biết chi tiết.

Khi vượt qua các chuỗi cho const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>97 hoặc let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }442, vui lòng xem xét cảnh báo khi sử dụng các chuỗi làm đầu vào cho API mật mã.

const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>6

Thuộc tính const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>61 có thể được sử dụng để thay đổi cách let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }449 được chuyển cho cuộc gọi lại. Tài sản này, tuy nhiên, đã được không dùng nữa và nên tránh sử dụng.

const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>7

Một loạt các chức năng tiêu hóa được hỗ trợ có thể được truy xuất bằng cách sử dụng let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }150.

let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }526##

  • API này sử dụng ThreadPool của Libuv, có thể có ý nghĩa hiệu suất tiêu cực và đáng ngạc nhiên đối với một số ứng dụng; Xem tài liệu let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }505 để biết thêm thông tin.
    • const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>97 | | |Default: let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }529
    • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }442 | | |
    • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }479
  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }444
  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }440

Trả lại:

Cung cấp triển khai chức năng dẫn xuất khóa dựa trên mật khẩu đồng bộ 2 (PBKDF2). Một thuật toán tiêu hóa HMAC được chọn được chỉ định bởi let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }440 được áp dụng để lấy một phím của chiều dài byte được yêu cầu (let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }444) từ const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>97, let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }442 và let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }479.

let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }548##

  • API này sử dụng ThreadPool của Libuv, có thể có ý nghĩa hiệu suất tiêu cực và đáng ngạc nhiên đối với một số ứng dụng; Xem tài liệu let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }505 để biết thêm thông tin.
    • const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>97 | | |
    • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }442 | | |
    • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }479
    • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }444
  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }444
  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }440

Trả lại:

Cung cấp triển khai chức năng dẫn xuất khóa dựa trên mật khẩu đồng bộ 2 (PBKDF2). Một thuật toán tiêu hóa HMAC được chọn được chỉ định bởi let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }440 được áp dụng để lấy một phím của chiều dài byte được yêu cầu (let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }444) từ const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>97, let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }442 và let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }479.

let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }571##

  • Nếu xảy ra lỗi, let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }517 sẽ bị ném, nếu không, khóa dẫn xuất sẽ được trả về dưới dạng let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }32.
    • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }442 | | |
    • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }479
    • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }444
  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }444
  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }440

Trả lại:

Cung cấp triển khai chức năng dẫn xuất khóa dựa trên mật khẩu đồng bộ 2 (PBKDF2). Một thuật toán tiêu hóa HMAC được chọn được chỉ định bởi let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }440 được áp dụng để lấy một phím của chiều dài byte được yêu cầu (let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }444) từ const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>97, let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }442 và let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }479.

Nếu xảy ra lỗi, let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }517 sẽ bị ném, nếu không, khóa dẫn xuất sẽ được trả về dưới dạng let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }32.

let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }594##

  • Nếu xảy ra lỗi, let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }517 sẽ bị ném, nếu không, khóa dẫn xuất sẽ được trả về dưới dạng let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }32.
    • Đối số let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }479 phải là một số được đặt càng cao càng tốt. Số lần lặp càng cao, khóa dẫn xuất càng an toàn, nhưng sẽ mất nhiều thời gian để hoàn thành.
    • const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>97 | | |Default: let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }529
    • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }530 | | | | Nhãn để sử dụng cho đệm OAEP. Nếu không được chỉ định, không có nhãn được sử dụng.
    • const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();28 | | | | Một cụm mật khẩu tùy chọn cho khóa riêng.
    • const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();67 Một giá trị đệm tùy chọn được xác định trong const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>60, có thể là: let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }533, const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();82 hoặc let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }535.
    • const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string8 Mã hóa chuỗi để sử dụng khi let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }49, const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string83, let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }530 hoặc const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();28 là chuỗi.
  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }49 | | | |
  • Trả về: Một let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }32 mới với nội dung được mã hóa.

Mã hóa nội dung của let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }49 với const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string83 và trả về let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }32 mới với nội dung được mã hóa. Dữ liệu được trả về có thể được giải mã bằng khóa riêng tương ứng, ví dụ bằng cách sử dụng let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }616.

Nếu const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string83 không phải là import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false62, chức năng này hoạt động như thể const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string83 đã được truyền đến import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false65. Nếu đó là một đối tượng, thuộc tính const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();67 có thể được thông qua. Mặt khác, chức năng này sử dụng let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }547.

Bởi vì các khóa công khai RSA có thể được lấy từ các khóa riêng, một khóa riêng có thể được thông qua thay vì khóa công khai.

let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }623##

  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }309 Số byte để tạo. let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }309 không được lớn hơn let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }626.
  • const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>78
    • const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>79
    • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }629
  • Trả về: Nếu hàm const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>78 không được cung cấp.

Tạo dữ liệu giả mạnh mẽ về mặt mật mã. Đối số let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }309 là một số chỉ ra số byte để tạo.

Nếu hàm const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>78 được cung cấp, các byte được tạo không đồng bộ và hàm const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>78 được gọi với hai đối số: const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>79 và let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }629. Nếu xảy ra lỗi, const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>79 sẽ là đối tượng let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }517; Nếu không thì đó là import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false55. Đối số let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }629 là let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }32 chứa các byte được tạo.

const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>8

Nếu hàm const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>78 không được cung cấp, các byte ngẫu nhiên được tạo đồng bộ và được trả về dưới dạng let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }32. Một lỗi sẽ được ném nếu có vấn đề tạo ra byte.

const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const publicKey = Certificate.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>9

Phương pháp let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }643 sẽ không hoàn thành cho đến khi có đủ entropy. Điều này thường không bao giờ mất nhiều thời gian hơn một vài mili giây. Lần duy nhất khi tạo các byte ngẫu nhiên có thể hình thành trong một khoảng thời gian dài hơn là ngay sau khi khởi động, khi toàn bộ hệ thống vẫn còn thấp trên entropy.

API này sử dụng ThreadPool của Libuv, có thể có ý nghĩa hiệu suất tiêu cực và đáng ngạc nhiên đối với một số ứng dụng; Xem tài liệu let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }505 để biết thêm thông tin.

Phiên bản không đồng bộ của let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }643 được thực hiện trong một yêu cầu duy nhất. Để giảm thiểu biến đổi độ dài tác vụ của ThreadPool, phân vùng lớn let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }646 Yêu cầu khi thực hiện như vậy như là một phần của việc đáp ứng yêu cầu của khách hàng.

let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }647##

  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }49 | | | Phải được cung cấp. Kích thước của let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }49 được cung cấp không được lớn hơn let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }626.
  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }651 Mặc định: const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>74Default: const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>74
  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }309 Mặc định: let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }654. let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }309 không được lớn hơn let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }626.Default: let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }654. The let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }309 must not be larger than let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }626.
  • Trả lại: | | | Đối tượng được truyền dưới dạng đối số let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }49.

Phiên bản đồng bộ của let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }658.

import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false0

Bất kỳ let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }345, let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }88 hoặc let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }89 có thể được thông qua là let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }49.

import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false1

let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }663##

  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }49 | | | Phải được cung cấp. Kích thước của let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }49 được cung cấp không được lớn hơn let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }626.
  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }651 Mặc định: const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>74Default: const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>74
  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }309 Mặc định: let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }654. let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }309 không được lớn hơn let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }626.Default: let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }654. The let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }309 must not be larger than let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }626.
  • Trả lại: | | | Đối tượng được truyền dưới dạng đối số let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }49.

Phiên bản đồng bộ của let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }658.

Bất kỳ let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }345, let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }88 hoặc let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }89 có thể được thông qua là let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }49.

import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false2

const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>78 let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }674.

Hàm này tương tự như let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }643 nhưng yêu cầu đối số đầu tiên là let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }32 sẽ được lấp đầy. Nó cũng yêu cầu một cuộc gọi lại được thông qua.

import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false3

API này sử dụng ThreadPool của Libuv, có thể có ý nghĩa hiệu suất tiêu cực và đáng ngạc nhiên đối với một số ứng dụng; Xem tài liệu let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }505 để biết thêm thông tin.

Phiên bản không đồng bộ của let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }643 được thực hiện trong một yêu cầu duy nhất. Để giảm thiểu biến đổi độ dài tác vụ của ThreadPool, phân vùng lớn let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }646 Yêu cầu khi thực hiện như vậy như là một phần của việc đáp ứng yêu cầu của khách hàng.

let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }690##

  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }49 | | | Phải được cung cấp. Kích thước của let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }49 được cung cấp không được lớn hơn let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }626.Default: const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>74.
  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }693 Kết thúc phạm vi ngẫu nhiên (độc quyền).
  • const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>78 let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }695.

Trả về một số nguyên ngẫu nhiên let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }696 sao cho let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }697. Việc thực hiện này tránh được sự thiên vị của modulo.

Phạm vi (let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }698) phải nhỏ hơn 248. let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }691 và let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }693 phải là số nguyên an toàn.

Nếu hàm const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>78 không được cung cấp, số nguyên ngẫu nhiên được tạo đồng bộ.

import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false4import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false5import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false6

let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }702##

Đã thêm vào: v15.6.0, v14.17.0

  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }50
    • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }704 Theo mặc định, để cải thiện hiệu suất, Node.js tạo và lưu trữ đủ dữ liệu ngẫu nhiên để tạo tối đa 128 UUID ngẫu nhiên. Để tạo UUID mà không sử dụng bộ đệm, đặt let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }704 thành import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false0. Mặc định: import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false2.Default: import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false2.
  • Trả lại:

Tạo một UUID RFC 4122 ngẫu nhiên. UUID được tạo bằng trình tạo số giả mã hóa mật mã.

let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }708##

  • const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>97 | | | |
  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }442 | | | |
  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }444
  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }50
    • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }704 Theo mặc định, để cải thiện hiệu suất, Node.js tạo và lưu trữ đủ dữ liệu ngẫu nhiên để tạo tối đa 128 UUID ngẫu nhiên. Để tạo UUID mà không sử dụng bộ đệm, đặt let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }704 thành import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false0. Mặc định: import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false2.Default: let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }714.
    • Trả lại:Default: let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }716.
    • Tạo một UUID RFC 4122 ngẫu nhiên. UUID được tạo bằng trình tạo số giả mã hóa mật mã.Default: let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }430.
    • const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>97 | | | |
    • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }442 | | | |
    • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }444
    • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }713 CPU/tham số chi phí bộ nhớ. Phải là một sức mạnh của hai lớn hơn một. Mặc định: let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }714.Default: let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }727.
  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }400 Tham số kích thước khối. Mặc định: let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }716.
    • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }717 Tham số song song. Mặc định: let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }430.
    • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }719 bí danh cho let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }713. Chỉ có một trong cả hai có thể được chỉ định.

let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }721 bí danh cho let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }400. Chỉ có một trong cả hai có thể được chỉ định.

let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }723 bí danh cho let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }717. Chỉ có một trong cả hai có thể được chỉ định.

let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }725 Bound bộ nhớ trên. Đó là một lỗi khi (xấp xỉ) let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }726. Mặc định: let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }727.

const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>78

const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>79

import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false7

let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }742##

  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }449
  • Cung cấp một triển khai Scrypt không đồng bộ. Scrypt là một chức năng phái sinh chính dựa trên mật khẩu được thiết kế để tính toán đắt tiền và khôn ngoan về bộ nhớ để làm cho các cuộc tấn công vũ phu không được hoàn thiện.
  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }444
  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }50
    • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }704 Theo mặc định, để cải thiện hiệu suất, Node.js tạo và lưu trữ đủ dữ liệu ngẫu nhiên để tạo tối đa 128 UUID ngẫu nhiên. Để tạo UUID mà không sử dụng bộ đệm, đặt let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }704 thành import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false0. Mặc định: import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false2.Default: let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }714.
    • Trả lại:Default: let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }716.
    • Tạo một UUID RFC 4122 ngẫu nhiên. UUID được tạo bằng trình tạo số giả mã hóa mật mã.Default: let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }430.
    • const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>97 | | | |
    • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }442 | | | |
    • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }444
    • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }713 CPU/tham số chi phí bộ nhớ. Phải là một sức mạnh của hai lớn hơn một. Mặc định: let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }714.Default: let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }727.
  • Trả lại:

Tạo một UUID RFC 4122 ngẫu nhiên. UUID được tạo bằng trình tạo số giả mã hóa mật mã.

let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }723 bí danh cho let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }717. Chỉ có một trong cả hai có thể được chỉ định.

let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }725 Bound bộ nhớ trên. Đó là một lỗi khi (xấp xỉ) let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }726. Mặc định: let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }727.

const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>78

const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>79

import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false8

let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }766##

let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }449

  • Cung cấp một triển khai Scrypt không đồng bộ. Scrypt là một chức năng phái sinh chính dựa trên mật khẩu được thiết kế để tính toán đắt tiền và khôn ngoan về bộ nhớ để làm cho các cuộc tấn công vũ phu không được hoàn thiện.
    • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }442 nên càng độc đáo càng tốt. Nên khuyến cáo rằng một muối là ngẫu nhiên và ít nhất 16 byte. Xem NIST SP 800-132 để biết chi tiết.
    • Khi vượt qua các chuỗi cho const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>97 hoặc let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }442, vui lòng xem xét cảnh báo khi sử dụng các chuỗi làm đầu vào cho API mật mã.
    • Hàm const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>78 được gọi với hai đối số: const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>79 và let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }449. const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>79 là một đối tượng ngoại lệ khi dẫn xuất chính không thành công, nếu không const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>79 là import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false55. let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }449 được chuyển cho cuộc gọi lại dưới dạng let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }32.
    • Một ngoại lệ được ném khi bất kỳ đối số đầu vào nào chỉ định các giá trị hoặc loại không hợp lệ.

let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }775##

const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>97 | | |

  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }442 | | |
  • Cung cấp một triển khai scrypt đồng bộ. Scrypt là một chức năng phái sinh chính dựa trên mật khẩu được thiết kế để tính toán đắt tiền và khôn ngoan về bộ nhớ để làm cho các cuộc tấn công vũ phu không được hoàn thiện.Default: let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }778

Một ngoại lệ được ném khi dẫn xuất khóa thất bại, nếu không, khóa dẫn xuất được trả về dưới dạng let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }32.

Đã thêm vào: V15.6.0

Trả lại:

  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }785
  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }786
  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }787
  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }788
  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }789
  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }790
  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }791
  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }792
  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }793
  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }778
  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }795

let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }796##

Đã thêm vào: v10.0.0

  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }797 import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false0 để bật chế độ FIPS.

Cho phép nhà cung cấp tiền điện tử tuân thủ FIP trong bản dựng Node.js hỗ trợ FIPS. Ném lỗi nếu chế độ FIP không khả dụng.

let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }799##

  • const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>96 | |
  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }79 | | |
  • const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string83 | | | | | | |
  • const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>78
    • const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>79
    • const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string38
  • Trả về: Nếu hàm const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>78 không được cung cấp.

Tính toán và trả về chữ ký cho let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }79 bằng cách sử dụng khóa và thuật toán riêng đã cho. Nếu const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>96 là import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false55 hoặc const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();04, thì thuật toán phụ thuộc vào loại chính (đặc biệt là ED25519 và ED448).

Nếu const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string83 không phải là import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false62, chức năng này hoạt động như thể const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string83 đã được truyền đến import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false66. Nếu đó là một đối tượng, các thuộc tính bổ sung sau đây có thể được thông qua:

  • const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();66 Đối với DSA và ECDSA, tùy chọn này chỉ định định dạng của chữ ký được tạo. Nó có thể là một trong những điều sau đây:

    • const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();16 (mặc định): Mã hóa chữ ký được mã hóa DER.1 const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();78.
    • const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();79: Định dạng chữ ký const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();80 như đề xuất trong IEEE-P1363.
  • const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();67 Giá trị đệm tùy chọn cho RSA, một trong những điều sau đây:

    • const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();82 (mặc định)
    • const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();83

    const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();84 sẽ sử dụng MGF1 với hàm băm tương tự được sử dụng để ký tin nhắn như được chỉ định trong Phần 3.1 của RFC 4055.

  • import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false86 Độ dài muối khi đệm là const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();84. Giá trị đặc biệt const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();87 đặt chiều dài muối thành kích thước tiêu hóa, const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();88 (mặc định) đặt nó thành giá trị tối đa cho phép.

Nếu hàm const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>78 được cung cấp chức năng này sử dụng ThreadPool của Libuv.

let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }829##

Đã thêm vào: v17.4.0

  • Loại hình:

Một bí danh thuận tiện cho let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }830.

let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }831##

  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }832 | | |
  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }833 | | |
  • Trả lại:

Hàm này so sánh các byte cơ bản đại diện cho các trường hợp let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }345, let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }88 hoặc let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }89 đã cho bằng thuật toán thời gian không đổi.

Hàm này không rò rỉ thông tin thời gian cho phép kẻ tấn công đoán được một trong các giá trị. Điều này phù hợp để so sánh các tiêu hóa HMAC hoặc các giá trị bí mật như cookie xác thực hoặc URL khả năng.

let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }832 và let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }833 phải là let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }32S, let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }88S hoặc let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }89 và chúng phải có cùng chiều dài byte. Một lỗi được ném nếu let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }832 và let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }833 có độ dài byte khác nhau.

Nếu ít nhất một trong số let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }832 và let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }833 là let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }88 với nhiều hơn một byte cho mỗi mục, chẳng hạn như let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }847, kết quả sẽ được tính toán bằng cách sử dụng thứ tự byte nền tảng.

Khi cả hai đầu vào là let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }682S hoặc let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }683, hàm này có thể trả về kết quả không mong muốn do mã hóa IEEE 754 của các số điểm nổi. Cụ thể, cả let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }850 và let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }851 đều không ngụ ý rằng các biểu diễn byte của hai số điểm nổi let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }852 và let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }853 bằng nhau.

Việc sử dụng let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }854 không đảm bảo rằng mã xung quanh an toàn về thời gian. Cần cẩn thận để đảm bảo rằng mã xung quanh không giới thiệu các lỗ hổng thời gian.

let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }855##

  • const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>96 | |
  • let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }79 | | |
  • const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string83 | | | | | | |
  • const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>78
  • const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>79
    • const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>79
    • const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const challenge = cert.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string38
  • Trả về: Nếu hàm const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>78 không được cung cấp.

Tính toán và trả về chữ ký cho let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }79 bằng cách sử dụng khóa và thuật toán riêng đã cho. Nếu const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>96 là import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const cert = Certificate(); const spkac = getSpkacSomehow(); console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false55 hoặc const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();04, thì thuật toán phụ thuộc vào loại chính (đặc biệt là ED25519 và ED448).

Nếu const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string83 không phải là import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false62, chức năng này hoạt động như thể const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 stringconst { Certificate } = require('node:crypto'); const spkac = getSpkacSomehow(); const challenge = Certificate.exportChallenge(spkac); console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string83 đã được truyền đến import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false66. Nếu đó là một đối tượng, các thuộc tính bổ sung sau đây có thể được thông qua:

  • const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();66 Đối với DSA và ECDSA, tùy chọn này chỉ định định dạng của chữ ký được tạo. Nó có thể là một trong những điều sau đây:

    • const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();16 (mặc định): Mã hóa chữ ký được mã hóa DER.1 const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();78.
    • const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();79: Định dạng chữ ký const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();80 như đề xuất trong IEEE-P1363.
  • const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();67 Giá trị đệm tùy chọn cho RSA, một trong những điều sau đây:

    • const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();82 (mặc định)
    • const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();83

    const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();84 sẽ sử dụng MGF1 với hàm băm tương tự được sử dụng để ký tin nhắn như được chỉ định trong Phần 3.1 của RFC 4055.

  • import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false86 Độ dài muối khi đệm là const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();84. Giá trị đặc biệt const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();87 đặt chiều dài muối thành kích thước tiêu hóa, const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();88 (mặc định) đặt nó thành giá trị tối đa cho phép.

Nếu hàm const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>78 được cung cấp chức năng này sử dụng ThreadPool của Libuv.

Đã thêm vào: v17.4.0

Nếu hàm const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>78 được cung cấp chức năng này sử dụng ThreadPool của Libuv.

let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }891##

Đã thêm vào: v15.0.0

Loại: Việc triển khai tiêu chuẩn API tiền điện tử web.

Xem tài liệu API Crypto Web để biết chi tiết.

Notes##

Sử dụng các chuỗi làm đầu vào cho API Cryptographic##

Vì lý do lịch sử, nhiều API mật mã được cung cấp bởi Node.js chấp nhận các chuỗi là đầu vào trong đó thuật toán mật mã cơ bản hoạt động trên các chuỗi byte. Các trường hợp này bao gồm các bản nhạc rõ ràng, mã hóa, khóa đối xứng, vectơ khởi tạo, vòng đệm, muối, thẻ xác thực và dữ liệu được xác thực bổ sung.

Khi chuyển chuỗi đến API mật mã, hãy xem xét các yếu tố sau.

  • Không phải tất cả các chuỗi byte là chuỗi UTF-8 hợp lệ. Do đó, khi một chuỗi byte có độ dài let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }696 có nguồn gốc từ một chuỗi, entropy của nó thường thấp hơn entropy của chuỗi byte ngẫu nhiên hoặc giả let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }696. Ví dụ: không có chuỗi UTF-8 sẽ dẫn đến chuỗi byte let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }894. Các khóa bí mật hầu như chỉ nên là ngẫu nhiên hoặc các chuỗi byte giả.

  • Tương tự, khi chuyển đổi các chuỗi byte ngẫu nhiên hoặc giả và các chuỗi Byte thành UTF-8, các chuỗi không đại diện cho các điểm mã hợp lệ có thể được thay thế bằng ký tự thay thế Unicode (let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }895). Do đó, biểu diễn byte của chuỗi unicode kết quả có thể không bằng chuỗi byte mà chuỗi được tạo từ.

    import { Buffer } from 'node:buffer'; const { Certificate } = await import('node:crypto'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or falseconst { Certificate } = require('node:crypto'); const { Buffer } = require('node:buffer'); const spkac = getSpkacSomehow(); console.log(Certificate.verifySpkac(Buffer.from(spkac))); // Prints: true or false9

    Đầu ra của mật mã, hàm băm, thuật toán chữ ký và các hàm dẫn xuất chính là các chuỗi byte giả và không nên được sử dụng làm chuỗi unicode.

  • Khi các chuỗi được lấy từ đầu vào của người dùng, một số ký tự Unicode có thể được biểu diễn theo nhiều cách tương đương dẫn đến các chuỗi byte khác nhau. Ví dụ: khi chuyển một mật khẩu người dùng cho chức năng phái sinh khóa, chẳng hạn như PBKDF2 hoặc Scrypt, kết quả của hàm dẫn xuất chính phụ thuộc vào việc chuỗi sử dụng các ký tự được cấu tạo hay bị phân tách. Node.js không bình thường hóa các biểu diễn ký tự. Các nhà phát triển nên xem xét sử dụng let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }896 trên đầu vào của người dùng trước khi chuyển chúng sang API mật mã.

API luồng kế thừa (trước Node.js 0.10)##

Mô -đun tiền điện tử đã được thêm vào Node.js trước khi có khái niệm về API luồng thống nhất và trước khi có các đối tượng let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }32 để xử lý dữ liệu nhị phân. Do đó, nhiều lớp được xác định const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();4 có các phương thức thường không tìm thấy trên các lớp Node.js khác thực hiện API luồng (ví dụ: let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }899, let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }900 hoặc let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }901). Ngoài ra, nhiều phương thức được chấp nhận và trả về const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>65 chuỗi được mã hóa theo mặc định thay vì let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }32s. Mặc định này đã được thay đổi sau khi Node.js v0.8 sử dụng các đối tượng let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }32 theo mặc định.

Hỗ trợ cho các thuật toán yếu hoặc bị xâm phạm##

Mô -đun const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();1 vẫn hỗ trợ một số thuật toán đã bị xâm phạm và hiện không được khuyến nghị sử dụng. API cũng cho phép sử dụng mật mã và băm có kích thước khóa nhỏ quá yếu để sử dụng an toàn.

Người dùng nên chịu trách nhiệm hoàn toàn để chọn thuật toán tiền điện tử và kích thước khóa theo yêu cầu bảo mật của họ.

Dựa trên các khuyến nghị của NIST SP 800-131A:

  • MD5 và SHA-1 không còn được chấp nhận khi cần phải có khả năng chống va chạm như chữ ký kỹ thuật số.
  • Khóa được sử dụng với các thuật toán RSA, DSA và DH được khuyến nghị có ít nhất 2048 bit và đường cong của ECDSA và ECDH ít nhất 224 bit, để được sử dụng trong vài năm.
  • Các nhóm DH của let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }906, let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }907 và let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }908 có kích thước chính nhỏ hơn 2048 bit và không được khuyến nghị.

Xem tài liệu tham khảo cho các khuyến nghị và chi tiết khác.

Một số thuật toán có điểm yếu đã biết và ít liên quan đến thực tế chỉ có sẵn thông qua nhà cung cấp di sản, không được bật theo mặc định.

Chế độ CCM##

CCM là một trong những thuật toán AEAD được hỗ trợ. Các ứng dụng sử dụng chế độ này phải tuân thủ các hạn chế nhất định khi sử dụng API mật mã:

  • Độ dài thẻ xác thực phải được chỉ định trong quá trình tạo mật mã bằng cách đặt tùy chọn let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }45 và phải là một trong 4, 6, 8, 10, 12, 14 hoặc 16 byte.
  • Độ dài của vectơ khởi tạo (nonce) let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }719 phải nằm trong khoảng từ 7 đến 13 byte (let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }911).
  • Độ dài của bản rõ được giới hạn ở let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }912 byte.
  • Khi giải mã, thẻ xác thực phải được đặt qua let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }913 trước khi gọi let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }899. Mặt khác, giải mã sẽ thất bại và let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }900 sẽ đưa ra lỗi tuân thủ phần 2.6 của RFC 3610.
  • Sử dụng các phương thức luồng như let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }916, let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }917 hoặc let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }918 trong chế độ CCM có thể thất bại vì CCM không thể xử lý nhiều hơn một đoạn dữ liệu cho mỗi trường hợp.
  • Khi truyền dữ liệu được xác thực bổ sung (AAD), độ dài của thông báo thực tế trong byte phải được chuyển sang let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }919 thông qua tùy chọn let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }52. Nhiều thư viện tiền điện tử bao gồm thẻ xác thực trong bản mã, điều đó có nghĩa là chúng tạo ra các mã hóa có độ dài let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }921. Node.js không bao gồm thẻ xác thực, do đó độ dài bản mã luôn luôn là let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }52. Điều này là không cần thiết nếu không có AAD được sử dụng.
  • Khi CCM xử lý toàn bộ tin nhắn cùng một lúc, let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }899 phải được gọi chính xác một lần.
  • Mặc dù gọi let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }899 là đủ để mã hóa/giải mã thông báo, các ứng dụng phải gọi let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }900 để tính toán hoặc xác minh thẻ xác thực.
const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();0

Hằng số tiền điện tử##

Các hằng số sau được xuất bởi const { Certificate } = await import('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>const { Certificate } = require('node:crypto'); const cert = Certificate(); const spkac = getSpkacSomehow(); const publicKey = cert.exportPublicKey(spkac); console.log(publicKey); // Prints: the public key as <Buffer ...>60 áp dụng cho các ứng dụng khác nhau của các mô -đun const { Certificate } = await import('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();const { Certificate } = require('node:crypto'); const cert1 = new Certificate(); const cert2 = Certificate();1, let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }928 và let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }929 và thường cụ thể cho OpenSSL.

Tùy chọn OpenSSL##

Xem danh sách các cờ OP SSL để biết chi tiết.

Không thay đổiSự mô tả
let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }930Áp dụng nhiều cách giải quyết lỗi trong OpenSSL. Xem //www.openssl.org/docs/man1.0.2/ssl/ssl_ctx_set_options.html để biết chi tiết.
let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }931Hướng dẫn OpenSSL cho phép chế độ trao đổi khóa không dựa trên [EC] DHE cho TLS v1.3
let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }932Cho phép các cuộc đàm phán lại không an toàn di sản giữa các máy khách hoặc máy chủ chưa được trang bị. Xem //www.openssl.org/docs/man1.0.2/ssl/ssl_ctx_set_options.html.
let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }933Cố gắng sử dụng tùy chọn của máy chủ thay vì của máy khách khi chọn mật mã. Hành vi phụ thuộc vào phiên bản giao thức. Xem //www.openssl.org/docs/man1.0.2/ssl/ssl_ctx_set_options.html.
let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }934Hướng dẫn OpenSSL sử dụng phiên bản "speshul" của Cisco của DTLS_BAD_VER.
let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }935Hướng dẫn OpenSSL để bật trao đổi cookie.
let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }936Hướng dẫn OpenSSL thêm phần mở rộng máy chủ-Hello từ phiên bản đầu của Dự thảo Cryptopro.
let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }937Hướng dẫn OpenSSL để vô hiệu hóa cách giải quyết lỗ hổng SSL 3.0/TLS 1.0 được thêm vào trong OpenSSL 0.9.6D.
let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }938Hướng dẫn OpenSSL luôn sử dụng khóa TMP_RSA khi thực hiện các hoạt động RSA.
let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }939Cho phép kết nối ban đầu với các máy chủ không hỗ trợ RI.
let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }940
let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }941
let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }942Hướng dẫn OpenSSL vô hiệu hóa cách giải quyết cho lỗ hổng phiên bản giao thức giữa các giao thức giữa trong quá trình triển khai máy chủ SSL 2.0.
let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }943
let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }944
let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }945
let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }946
let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }947Hướng dẫn OpenSSL để vô hiệu hóa hỗ trợ cho nén SSL/TLS.
let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }948Hướng dẫn OpenSSL để vô hiệu hóa Encrypt-Then-Mac.
let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }949
let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }950Hướng dẫn OpenSSL để vô hiệu hóa đàm phán lại.
let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }951Hướng dẫn OpenSSL luôn bắt đầu một phiên mới khi thực hiện đàm phán lại.
let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }952Hướng dẫn OpenSSL tắt SSL v2
let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }953Hướng dẫn OpenSSL tắt SSL V3
let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }954Hướng dẫn OpenSSL để vô hiệu hóa việc sử dụng vé RFC4507BIS.
let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }955Hướng dẫn OpenSSL tắt TLS v1
let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }956Hướng dẫn OpenSSL tắt TLS v1.1
let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }957Hướng dẫn OpenSSL tắt TLS v1.2
let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }958Hướng dẫn OpenSSL tắt TLS v1.3
let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }959
let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }960
let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }961Hướng dẫn máy chủ OpenSSL ưu tiên Chacha20-poly1305 khi khách hàng thực hiện. Tùy chọn này không có tác dụng nếu let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }933 không được bật.
let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }963Hướng dẫn OpenSSL luôn tạo khóa mới khi sử dụng các tham số DH tạm thời/phù du.
let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }964Hướng dẫn OpenSSL luôn tạo khóa mới khi sử dụng các tham số ECDH tạm thời/phù du.
let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }965
let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }966
let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }967
let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }968
let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }969Hướng dẫn OpenSSL để vô hiệu hóa phát hiện tấn công rollback phiên bản.

Hằng số động cơ openSSL##

Không thay đổiSự mô tả
let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }930Áp dụng nhiều cách giải quyết lỗi trong OpenSSL. Xem //www.openssl.org/docs/man1.0.2/ssl/ssl_ctx_set_options.html để biết chi tiết.
let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }931Hướng dẫn OpenSSL cho phép chế độ trao đổi khóa không dựa trên [EC] DHE cho TLS v1.3
let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }932Cho phép các cuộc đàm phán lại không an toàn di sản giữa các máy khách hoặc máy chủ chưa được trang bị. Xem //www.openssl.org/docs/man1.0.2/ssl/ssl_ctx_set_options.html.
let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }933Cố gắng sử dụng tùy chọn của máy chủ thay vì của máy khách khi chọn mật mã. Hành vi phụ thuộc vào phiên bản giao thức. Xem //www.openssl.org/docs/man1.0.2/ssl/ssl_ctx_set_options.html.
let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }934Hướng dẫn OpenSSL sử dụng phiên bản "speshul" của Cisco của DTLS_BAD_VER.
let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }935Hướng dẫn OpenSSL để bật trao đổi cookie.
let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }936Hướng dẫn OpenSSL thêm phần mở rộng máy chủ-Hello từ phiên bản đầu của Dự thảo Cryptopro.
let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }937Hướng dẫn OpenSSL để vô hiệu hóa cách giải quyết lỗ hổng SSL 3.0/TLS 1.0 được thêm vào trong OpenSSL 0.9.6D.
let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }938Hướng dẫn OpenSSL luôn sử dụng khóa TMP_RSA khi thực hiện các hoạt động RSA.
let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }939
Cho phép kết nối ban đầu với các máy chủ không hỗ trợ RI.

let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }940#

Không thay đổiSự mô tả
let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }941
let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }942
Hướng dẫn OpenSSL vô hiệu hóa cách giải quyết cho lỗ hổng phiên bản giao thức giữa các giao thức giữa trong quá trình triển khai máy chủ SSL 2.0.
let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }943
let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }944
let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }945
let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }946
let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }947
Hướng dẫn OpenSSL để vô hiệu hóa hỗ trợ cho nén SSL/TLS.
let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }948
Hướng dẫn OpenSSL để vô hiệu hóa Encrypt-Then-Mac.
let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }949let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }950
Hướng dẫn OpenSSL để vô hiệu hóa đàm phán lại.let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }951
Hướng dẫn OpenSSL luôn bắt đầu một phiên mới khi thực hiện đàm phán lại.let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }952
Hướng dẫn OpenSSL tắt SSL v2
let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }953
Hướng dẫn OpenSSL tắt SSL V3

let crypto; try { crypto = require('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }954#

Không thay đổiSự mô tả
let crypto; try { crypto = await import('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }001Chỉ định danh sách mật mã mặc định tích hợp được sử dụng bởi Node.js.
let crypto; try { crypto = await import('node:crypto'); } catch (err) { console.log('crypto support is disabled!'); }002Chỉ định danh sách mật mã mặc định hoạt động được sử dụng bởi quy trình Node.js hiện tại.

Tại sao chúng ta sử dụng tiền điện tử trong JS?

Ứng dụng JS. Crypto cho phép bạn băm các văn bản đơn giản trước khi lưu trữ chúng trong cơ sở dữ liệu. Đối với điều này, bạn có một lớp băm có thể tạo ra độ dài cố định, xác định, chống va chạm và băm đơn hướng. Đối với dữ liệu băm, mật khẩu không thể được giải mã bằng khóa được xác định trước, không giống như dữ liệu được mã hóa.allows you to hash plain texts before storing them in the database. For this, you have a hash class that can create fixed length, deterministic, collision-resistant, and unidirectional hashes. For hashed data, a password cannot be decrypted with a predetermined key, unlike encrypted data.

Crypto trong Node JS là gì?

Crypto là một mô -đun trong Node.js liên quan đến thuật toán thực hiện mã hóa và giải mã dữ liệu.Điều này được sử dụng cho mục đích bảo mật như xác thực người dùng trong đó lưu trữ mật khẩu trong cơ sở dữ liệu ở dạng được mã hóa.Mô -đun Crypto cung cấp tập hợp các lớp như băm, HMAC, mật mã, giải mã, dấu hiệu và xác minh.a module in Node. js which deals with an algorithm that performs data encryption and decryption. This is used for security purpose like user authentication where storing the password in Database in the encrypted form. Crypto module provides set of classes like hash, HMAC, cipher, decipher, sign, and verify.

API tiền điện tử là gì?

API Web Crypto là một giao diện cho phép tập lệnh sử dụng các nguyên thủy mật mã để xây dựng các hệ thống bằng mật mã.an interface allowing a script to use cryptographic primitives in order to build systems using cryptography.

Mô -đun tiền điện tử hoạt động như thế nào?

Mô -đun Crypto là một trình bao bọc cho các chức năng mật mã của OpenSSL.Nó hỗ trợ các băm tính toán, xác thực với HMAC, mật mã, và nhiều hơn nữa!Mô -đun Crypto chủ yếu hữu ích như một công cụ để thực hiện các giao thức mật mã như TLS và HTTPS.It supports calculating hashes, authentication with HMAC, ciphers, and more! The crypto module is mostly useful as a tool for implementing cryptographic protocols such as TLS and https.

Chủ đề