29 lines
502 B
Plaintext
29 lines
502 B
Plaintext
== How to fix it in CommonCrypto
|
|
|
|
=== Code examples
|
|
|
|
include::../../common/fix/code-rationale.adoc[]
|
|
|
|
==== Noncompliant code example
|
|
|
|
[source,swift,diff-id=1,diff-type=noncompliant]
|
|
----
|
|
import CommonCrypto
|
|
|
|
let algorithm = CCAlgorithm(kCCAlgorithmDES) // Noncompliant
|
|
----
|
|
|
|
==== Compliant solution
|
|
|
|
[source,swift,diff-id=1,diff-type=compliant]
|
|
----
|
|
import Crypto
|
|
|
|
let sealedBox = try AES.GCM.seal(input, using: key)
|
|
----
|
|
|
|
=== How does this work?
|
|
|
|
include::../../common/fix/strong-cryptography.adoc[]
|
|
|