静态方法:Certificate.exportPublicKey(spkac[, encoding])
【Static method: Certificate.exportPublicKey(spkac[, encoding])】
spkac<string> | <ArrayBuffer> | <Buffer> | <TypedArray> | <DataView>encoding<string>spkac字符串的 编码。- 返回: <Buffer>
spkac数据结构的公钥部分,其中包括公钥和挑战码。
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 ...>