( algorithm, extractable, usages, )
| 99 | } |
| 100 | |
| 101 | function rsaKeyGenerate( |
| 102 | algorithm, |
| 103 | extractable, |
| 104 | usages, |
| 105 | ) { |
| 106 | const publicExponentConverted = bigIntArrayToUnsignedInt(algorithm.publicExponent); |
| 107 | if (publicExponentConverted === undefined) { |
| 108 | throw lazyDOMException( |
| 109 | 'The publicExponent must be equivalent to an unsigned 32-bit value', |
| 110 | 'OperationError'); |
| 111 | } |
| 112 | const { |
| 113 | name, |
| 114 | modulusLength, |
| 115 | publicExponent, |
| 116 | hash, |
| 117 | } = algorithm; |
| 118 | |
| 119 | const allowedUsages = kUsages[name]; |
| 120 | const usagesSet = validateKeyUsages(usages, allowedUsages.keygen, name); |
| 121 | |
| 122 | const keyAlgorithm = { |
| 123 | name, |
| 124 | modulusLength, |
| 125 | publicExponent, |
| 126 | hash, |
| 127 | }; |
| 128 | |
| 129 | if (publicExponentConverted < 3 || publicExponentConverted % 2 === 0) { |
| 130 | throw lazyDOMException( |
| 131 | 'The operation failed for an operation-specific reason', |
| 132 | 'OperationError'); |
| 133 | } |
| 134 | |
| 135 | const keyUsages = getKeyPairUsages(usagesSet, allowedUsages); |
| 136 | validateUsagesNotEmpty(keyUsages.private); |
| 137 | |
| 138 | return jobPromise(() => new RsaKeyPairGenJob( |
| 139 | kCryptoJobWebCrypto, |
| 140 | kKeyVariantRSA_SSA_PKCS1_v1_5, |
| 141 | modulusLength, |
| 142 | publicExponentConverted, |
| 143 | keyAlgorithm, |
| 144 | getUsagesMask(keyUsages.public), |
| 145 | getUsagesMask(keyUsages.private), |
| 146 | extractable)); |
| 147 | } |
| 148 | |
| 149 | function rsaExportKey(key, format) { |
| 150 | try { |
nothing calls this directly
no test coverage detected
searching dependent graphs…