
Co-authored-by: hendrik-buchwald-sonarsource <64110887+hendrik-buchwald-sonarsource@users.noreply.github.com>
30 lines
590 B
Plaintext
30 lines
590 B
Plaintext
== How to fix it in Node.js
|
|
|
|
=== Code examples
|
|
|
|
==== Noncompliant code example
|
|
|
|
include::../../common/fix/aes-noncompliant-example.adoc[]
|
|
|
|
[source,javascript,diff-id=1,diff-type=noncompliant]
|
|
----
|
|
const crypto = require('crypto');
|
|
|
|
crypto.createCipheriv("AES-128-CBC", key, iv); // Noncompliant
|
|
----
|
|
|
|
==== Compliant solution
|
|
|
|
include::../../common/fix/aes-noncompliant-example.adoc[]
|
|
|
|
[source,javascript,diff-id=1,diff-type=compliant]
|
|
----
|
|
const crypto = require('crypto');
|
|
|
|
crypto.createCipheriv("AES-256-GCM", key, iv);
|
|
----
|
|
|
|
=== How does this work?
|
|
|
|
include::../../common/fix/fix.adoc[]
|