29 lines
540 B
Plaintext
29 lines
540 B
Plaintext
![]() |
== How to fix it in CryptoSwift
|
||
|
|
||
|
=== Code examples
|
||
|
|
||
|
include::../../common/fix/code-rationale.adoc[]
|
||
|
|
||
|
==== Noncompliant code example
|
||
|
|
||
|
[source,swift,diff-id=1,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=1,diff-type=compliant]
|
||
|
----
|
||
|
import CryptoSwift
|
||
|
|
||
|
let aes = try AES(key: key, iv: iv)
|
||
|
----
|
||
|
|
||
|
=== How does this work?
|
||
|
|
||
|
include::../../common/fix/strong-cryptography.adoc[]
|
||
|
|