Skip to content

algorithm: .tripleDES, mode: .CBC is not working proper. #112

Open
@Jagaa9a

Description

@Jagaa9a

Hello @iosdevzone,

I am working on iOS swift project that encrypts and decrypts transfer data with TDES 2key CBC algorithm. Luckily, I found your repo and tried to implement it for my project. Below is my testing crypto code.

`
import Foundation
import IDZSwiftCommonCrypto

let algorithm = Cryptor.Algorithm.tripleDES
let iv = arrayFrom(hexString: "00000000000000000000000000000000")
let key = arrayFrom(hexString: "6522B4E171195BB218223A976C040111")

let cryptor = Cryptor(operation: .encrypt, algorithm: .tripleDES, mode: .CBC, padding: .NoPadding, key: key, iv: iv)
let cipherText = cryptor.update(arrayFrom(hexString: "11223344556677885A6E7E385162B7A3404142434445464748494A4B4C4D4E4F"))?.final()
`

It is working without error but the result is not right! I was expecting

937745c20883a1bad1e04193722a1592378f81a8f1dc589157aeb0f7544fa1ba

But Its result is

669747ad72be1037380ea630796ce9e974d7433a1ff05f923f51718cadf95d80
Can you help us to solve this problem?

Xcode 11.4 (11E146)
Playground Settings iOS
IDZSwiftCommonCrypto 0.13.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions