29 lines
530 B
Plaintext
29 lines
530 B
Plaintext
== How to fix it in Node.js
|
|
|
|
=== Code examples
|
|
|
|
include::../../common/fix/code-rationale.adoc[]
|
|
|
|
==== Noncompliant code example
|
|
|
|
[source,javascript,diff-id=1,diff-type=noncompliant]
|
|
----
|
|
const crypto = require('crypto');
|
|
|
|
crypto.createCipheriv("DES", key, iv); // Noncompliant
|
|
----
|
|
|
|
==== Compliant solution
|
|
|
|
[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/strong-cryptography.adoc[]
|
|
|