Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> การเขียนโปรแกรม >> JavaScript

เมธอด crypto.getCurves() ใน Node.js

เมธอด crypto.getCurves() คืนค่า array ที่มีชื่อของ elliptic curves ที่รองรับทั้งหมด ใช้สำหรับสร้าง Elliptic Curve Diffie-Hellman (ECDH) key exchange object

ไวยากรณ์

crypto.getCurves()

พารามิเตอร์

ไม่ต้องมีพารามิเตอร์

ตัวอย่าง

const crypto = require('crypto');
const curves = crypto.getCurves();
console.log("The list of all elliptic curves are as follows: ", curves);

ผลลัพธ์ (บางส่วน)

[
  'Oakley-EC2N-3', 'Oakley-EC2N-4', 'SM2',
  'brainpoolP160r1', 'brainpoolP160t1', 'brainpoolP192r1', ...,
  'secp256k1', 'secp384r1', 'secp521r1',
  'sect163k1', 'sect163r1', 'sect163r2', ...,
  'wap-wsg-idm-ecid-wtls1', ..., 'wap-wsg-idm-ecid-wtls12'
]

รายการเต็มมีมากกว่า 80 curves