
Improvement identified in #2790. Add a prefix to the diff-id when it is used multiple times in different "how to fix it in XYZ" sections to avoid ambiguity and pedantically follow the spec: > A single and unique diff-id should be used only once for each type of code example as shown in the description of a rule.
29 lines
542 B
Plaintext
29 lines
542 B
Plaintext
== How to fix it in CryptoSwift
|
|
|
|
=== Code examples
|
|
|
|
include::../../common/fix/code-rationale.adoc[]
|
|
|
|
==== Noncompliant code example
|
|
|
|
[source,swift,diff-id=21,diff-type=noncompliant]
|
|
----
|
|
import CryptoSwift
|
|
|
|
let blowfish = try Blowfish(key: key, blockMode: GCM(iv: iv, mode: .combined), padding: .pkcs7) // Noncompliant
|
|
----
|
|
|
|
==== Compliant solution
|
|
|
|
[source,swift,diff-id=21,diff-type=compliant]
|
|
----
|
|
import CryptoSwift
|
|
|
|
let aes = try AES(key: key, iv: iv)
|
|
----
|
|
|
|
=== How does this work?
|
|
|
|
include::../../common/fix/strong-cryptography.adoc[]
|
|
|