(key, format)
| 89 | } |
| 90 | |
| 91 | function cfrgExportKey(key, format) { |
| 92 | try { |
| 93 | switch (format) { |
| 94 | case kWebCryptoKeyFormatRaw: { |
| 95 | const handle = getCryptoKeyHandle(key); |
| 96 | return TypedArrayPrototypeGetBuffer( |
| 97 | getCryptoKeyType(key) === 'private' ? handle.rawPrivateKey() : handle.rawPublicKey()); |
| 98 | } |
| 99 | case kWebCryptoKeyFormatSPKI: { |
| 100 | return TypedArrayPrototypeGetBuffer( |
| 101 | getCryptoKeyHandle(key).export(kKeyFormatDER, kWebCryptoKeyFormatSPKI)); |
| 102 | } |
| 103 | case kWebCryptoKeyFormatPKCS8: { |
| 104 | return TypedArrayPrototypeGetBuffer( |
| 105 | getCryptoKeyHandle(key).export(kKeyFormatDER, kWebCryptoKeyFormatPKCS8, null, null)); |
| 106 | } |
| 107 | default: |
| 108 | return undefined; |
| 109 | } |
| 110 | } catch (err) { |
| 111 | throw lazyDOMException( |
| 112 | 'The operation failed for an operation-specific reason', |
| 113 | { name: 'OperationError', cause: err }); |
| 114 | } |
| 115 | } |
| 116 | |
| 117 | function cfrgImportKey( |
| 118 | format, |
nothing calls this directly
no test coverage detected
searching dependent graphs…