rspec/rules/S5547/swift/how-to-fix-it/cryptoswift.adoc
Marco Borgeaud 4aee7ce2d6
Diff blocks: fix incorrect use for swift (#2805)
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.
2023-08-15 11:52:10 +02:00

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[]