SecureCompatibleEncryptionExamples icon indicating copy to clipboard operation
SecureCompatibleEncryptionExamples copied to clipboard

authTagValidation error Swift

Open igorrendulic opened this issue 4 years ago • 4 comments

I've imported the Swift example and run it on one of the ciphertexts from the README file. The decrypt function always returns authTagValidation error.

I'm using Swift 5, imported SwiftGCM and CommonCrypto.

Example test code:

func testSjclEncrypt() {
       let test = "5EmCwwSWj6YYgxBlld6DFW8I+QXCWxz5g/laEwUYV/DuoCGvxbW4ZlMd1Tsj4N07WbBOhIJU"
        do  {
            let decrypted = try AES256.decryptString(ciphertext: test, password: "OziaxPFGYh")
            print("decrypted: \(decrypted)")
        } catch (let error) {
            print("this is error: \(error)")
        }
    }

igorrendulic avatar Sep 09 '19 01:09 igorrendulic

Further investigation leads me to discover that Swift is not compatible with Javascript - SJCL. I'm not really an encryption expert, I'd just like to use compatible libraries. Is there a way I can provide more information on this to figure out where the problem may be?

Shortly. Using encryption/decryption witing Javascript works, using encryption with Javascript SJCL and Swift to decrypt, doesn't work.

igorrendulic avatar Sep 09 '19 17:09 igorrendulic

Hi @igorrendulic my SwiftGCM library is in need of a bit of maintenance which I intend to do this week. They are definitely compatible - an encryption algorithm can be implemented in any language.

luke-park avatar Sep 10 '19 04:09 luke-park

Awesome! Let me know if I can help to test.

igorrendulic avatar Sep 10 '19 21:09 igorrendulic

Hello

I have the same issue, any news or an update? @luke-park

Thank you

YahyaDevelop avatar Jan 24 '22 14:01 YahyaDevelop