MCPcopy Index your code
hub / github.com/nodejs/node / exportKeySpki

Function exportKeySpki

lib/internal/crypto/webcrypto.js:423–463  ·  view source on GitHub ↗
(key)

Source from the content-addressed store, hash-verified

421}
422
423function exportKeySpki(key) {
424 switch (getCryptoKeyAlgorithm(key).name) {
425 case 'RSASSA-PKCS1-v1_5':
426 // Fall through
427 case 'RSA-PSS':
428 // Fall through
429 case 'RSA-OAEP':
430 return require('internal/crypto/rsa')
431 .rsaExportKey(key, kWebCryptoKeyFormatSPKI);
432 case 'ECDSA':
433 // Fall through
434 case 'ECDH':
435 return require('internal/crypto/ec')
436 .ecExportKey(key, kWebCryptoKeyFormatSPKI);
437 case 'Ed25519':
438 // Fall through
439 case 'Ed448':
440 // Fall through
441 case 'X25519':
442 // Fall through
443 case 'X448':
444 return require('internal/crypto/cfrg')
445 .cfrgExportKey(key, kWebCryptoKeyFormatSPKI);
446 case 'ML-DSA-44':
447 // Fall through
448 case 'ML-DSA-65':
449 // Fall through
450 case 'ML-DSA-87':
451 return require('internal/crypto/ml_dsa')
452 .mlDsaExportKey(key, kWebCryptoKeyFormatSPKI);
453 case 'ML-KEM-512':
454 // Fall through
455 case 'ML-KEM-768':
456 // Fall through
457 case 'ML-KEM-1024':
458 return require('internal/crypto/ml_kem')
459 .mlKemExportKey(key, kWebCryptoKeyFormatSPKI);
460 default:
461 return undefined;
462 }
463}
464
465function exportKeyPkcs8(key) {
466 switch (getCryptoKeyAlgorithm(key).name) {

Callers 1

exportKeySyncFunction · 0.85

Calls 2

getCryptoKeyAlgorithmFunction · 0.85
requireFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…