| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -53,7 +53,7 @@ The `crypto` module provides the `Certificate` class for working with SPKAC | |||
| 53 | 53 | data. The most common usage is handling output generated by the HTML5 | |
| 54 | 54 | `<keygen>` element. Node.js uses [OpenSSL's SPKAC implementation][] internally. | |
| 55 | 55 | ||
| 56 | - ### `Certificate.exportChallenge(spkac[, encoding])` | ||
| 56 | + ### Static method: `Certificate.exportChallenge(spkac[, encoding])` | ||
| 57 | 57 | <!-- YAML | |
| 58 | 58 | added: v9.0.0 | |
| 59 | 59 | changes: | |
@@ -76,7 +76,7 @@ console.log(challenge.toString('utf8')); | |||
| 76 | 76 | // Prints: the challenge as a UTF8 string | |
| 77 | 77 | ``` | |
| 78 | 78 | ||
| 79 | - ### `Certificate.exportPublicKey(spkac[, encoding])` | ||
| 79 | + ### Static method: `Certificate.exportPublicKey(spkac[, encoding])` | ||
| 80 | 80 | <!-- YAML | |
| 81 | 81 | added: v9.0.0 | |
| 82 | 82 | changes: | |
@@ -99,7 +99,7 @@ console.log(publicKey); | |||
| 99 | 99 | // Prints: the public key as <Buffer ...> | |
| 100 | 100 | ``` | |
| 101 | 101 | ||
| 102 | - ### `Certificate.verifySpkac(spkac[, encoding])` | ||
| 102 | + ### Static method: `Certificate.verifySpkac(spkac[, encoding])` | ||
| 103 | 103 | <!-- YAML | |
| 104 | 104 | added: v9.0.0 | |
| 105 | 105 | changes: | |
@@ -1284,6 +1284,32 @@ passing keys as strings or `Buffer`s due to improved security features. | |||
| 1284 | 1284 | The receiver obtains a cloned `KeyObject`, and the `KeyObject` does not need to | |
| 1285 | 1285 | be listed in the `transferList` argument. | |
| 1286 | 1286 | ||
| 1287 | + ### Static method: `KeyObject.from(key)` | ||
| 1288 | + <!-- YAML | ||
| 1289 | + added: v15.0.0 | ||
| 1290 | + --> | ||
| 1291 | + | ||
| 1292 | + * `key` {CryptoKey} | ||
| 1293 | + * Returns: {KeyObject} | ||
| 1294 | + | ||
| 1295 | + Example: Converting a `CryptoKey` instance to a `KeyObject`: | ||
| 1296 | + | ||
| 1297 | + ```js | ||
| 1298 | + const { webcrypto: { subtle }, KeyObject } = require('crypto'); | ||
| 1299 | + | ||
| 1300 | + (async function() { | ||
| 1301 | + const key = await subtle.generateKey({ | ||
| 1302 | + name: 'HMAC', | ||
| 1303 | + hash: 'SHA-256', | ||
| 1304 | + length: 256 | ||
| 1305 | + }, true, ['sign', 'verify']); | ||
| 1306 | + | ||
| 1307 | + const keyObject = KeyObject.from(key); | ||
| 1308 | + console.log(keyObject.symmetricKeySize); | ||
| 1309 | + // Prints: 32 (symmetric key size in bytes) | ||
| 1310 | + })(); | ||
| 1311 | + ``` | ||
| 1312 | + | ||
| 1287 | 1313 | ### `keyObject.asymmetricKeyDetails` | |
| 1288 | 1314 | <!-- YAML | |
| 1289 | 1315 | added: v15.7.0 | |
| Back | FazBrowse Home | New Git URL |
0 commit comments