(key, _algorithm, extractable, keyUsages)
| 58 | } |
| 59 | |
| 60 | static async importKey(key, _algorithm, extractable, keyUsages) { |
| 61 | if (keyUsages.length !== 1 || keyUsages[0] !== "encrypt") { |
| 62 | throw new Error("only support importing RSA public key"); |
| 63 | } |
| 64 | const cipher = new RSACipher; |
| 65 | await cipher._importKey(key, extractable); |
| 66 | return cipher; |
| 67 | } |
| 68 | |
| 69 | async _importKey(key, extractable) { |
| 70 | const n = key.n; |