# HG changeset patch # User Yaroslav Zhuravlev # Date 1675345506 0 # Node ID 16613b91c58419f6e454446066de6862d1abea68 # Parent 215deab422864f66ec9ed4178a71f103dc63c641 Extended support for symmetric/assymetric keys in WebCrypto njs. diff --git a/xml/en/docs/njs/reference.xml b/xml/en/docs/njs/reference.xml --- a/xml/en/docs/njs/reference.xml +++ b/xml/en/docs/njs/reference.xml @@ -9,7 +9,7 @@
+ rev="96">
@@ -1908,6 +1908,227 @@ that contains the data to be digested +сrypto.subtle.exportKey(format, +key) + +Exports a key: takes a key as a CryptoKey object +and returns the key in an external, portable format +(since 0.7.10). +If the format was jwk, +then the Promise fulfills with a JSON object +containing the key. +Otherwise, the promise fulfills with an +ArrayBuffer containing the key. +Possible values: + + +format + +a string that describes the data format in which the key should be exported, +can be the following: + + +raw + +the raw data format + + +pkcs8 + +the +PKCS #8 +format + + +spki + +the +SubjectPublicKeyInfo +format + + +jwk + +the +JSON Web Key +(JWK) format (since 0.7.10) + + + + + +key + +the CryptoKey that contains the key to be exported + + + + + +сrypto.subtle.generateKey(algorithm, +extractable, +usage) + +Generates a new key for symmetric algorithms +or key pair for public-key algorithms +(since 0.7.10). +Returns a Promise that fulfills with the generated key +as a CryptoKey or CryptoKeyPair object. +Possible values: + + +algorithm + +a dictionary object that defines the type of key to generate +and provides extra algorithm-specific parameters: + + + +for +RSASSA-PKCS1-v1_5, +RSA-PSS, or +RSA-OAEP, +pass the object with the following keys: + + + +name is a string, should be set to +RSASSA-PKCS1-v1_5, +RSA-PSS, or +RSA-OAEP, +depending on the used algorithm + + + +hash is a string that represents +the name of the digest function to use, can be +SHA-256, +SHA-384, or +SHA-512 + + + + + + +for +ECDSA, +pass the object with the following keys: + + + +name is a string, should be set to ECDSA + + + +namedCurve is a string that represents +the name of the elliptic curve to use, may be +P-256, +P-384, or +P-521 + + + + + + +for +HMAC, +pass the object with the following keys: + + + +name is a string, should be set to HMAC + + + + +hash is a string that represents +the name of the digest function to use, can be +SHA-256, +SHA-384, or +SHA-512 + + + +length (optional) is a number that represents +the length in bits of the key. +If omitted, the length of the key is equal to the length of the digest +generated by the chosen digest function. + + + + + + +for +AES-CTR, +AES-CBC, or +AES-GCM, +pass the string identifying the algorithm or an object +of the form { "name": "ALGORITHM" }, +where ALGORITHM is the name of the algorithm + + + + + +extractable + +boolean value that indicates if it is possible to export the key + + +usage + +an array that indicates possible actions with the key: + + +encrypt + +key for encrypting messages + + +decrypt + +key for decrypting messages + + +sign + +key for signing messages + + +verify + +key for verifying signatures + + +deriveKey + +key for deriving a new key + + +deriveBits + +key for deriving bits + + +wrapKey + +key for wrapping a key + + +unwrapKey + +key for unwrapping a key + + + + + + + + сrypto.subtle.importKey(format, keyData, algorithm, @@ -1942,10 +2163,17 @@ format spki the -SubjectPublicKeyInfo +SubjectPublicKeyInfo format +jwk + +the +JSON Web Key +(JWK) format (since 0.7.10) + +