skavinvarnan / Cross-Platform-AES

Simple cross-platform encryption and decryption using AES
MIT License
142 stars 69 forks source link

IOS Failes to decrypt VB.net String #22

Open mld54444 opened 5 years ago

mld54444 commented 5 years ago

Dear first i would like to than you about your great cryptlib

But i'm using it in android and swift

in android i managed to decrypt the string returned from the server successfully but in IOS it keeps giving me errors or strange output data like :

ÄľIßþÑÔ×Q0•‹z•lz·\'ù\u{0E} ¤*]9\u{15}ï!EF\nëåt<NxýaI\u{1D}‘\u{03} N3\u{07}½lô·÷=\u{1D}?ì\u{05}ÂòÅ·#Ñèâ\u{05}’=0Ñ<‰á\u{1D}\t\u{1E}!»>k/t\rÄ\u{07}K{-êg&ZÓ?\0o¸\u{06}ˆ)ŸÝSX7ÜF\u{0F}]€[ïÎX-‰TÌœâ]¿ü.‚\nS\u{19}ÂN3!\u{15}\u{10}К¥ÍQUö„›\'Ï~N\u{0E}€‚F;»ª:sÿÒZ°óD:¿\u{19}\u{1A}†ŽvL

here is an example to try to decrypt

IV = 509+QAilldg3dj3p key string "sha256" = 2c8bc04829771e56a064e192425f0f98 Encrypted text = LbA/hK1DfsyqvwPKuyvKH90cFh6u6WfUBvFgv7XLtjNB4s++iJFSdLbAAIYLsFwh4HpZLzWMA5VCZTNwPUztvflIdTfyZ99y9B6Il+KHUKWNsgSlw6WgPw9ZGy+3zpZkaYmI8KkJj9hudeiCODxknXIJ26hkfjbAl9BRJg2GHyNKN1or+DR82Gxtfx6srbHS1jV/vItcZEOKRdaWzdRhGZ1HwYOD5cVg6xdt8Gts3dU=

Can you please help me because i'm frustrated and i failed to decode it using all samples in we

this string is returned from VB.net service Regards

tarakinsuide commented 4 years ago

I'm facing similar issues. Did you find the solution to this?

skavinvarnan commented 4 years ago

@tarakinsuide processed in VB.net?

tarakinsuide commented 4 years ago

Hi,

Sorry, it's not about .NET

I'm encrypting on NodeJS and trying to decrypt on iOS using the examples given in your repo. But, the output is jargon strings.

I tried few solutions given in #29 but it didn't work for me.

skavinvarnan commented 4 years ago

@tarakinsuide the library has been updated to support iOS 13. Start fresh and try this example. https://github.com/skavinvarnan/Cross-Platform-AES#javascript--nodejs--web

reunitedaditya commented 4 years ago

Hey i am using the updated iOS13 Version of the library and the decrypt function is still not working.

  let plainText = "this is my plain text"
    let key = "PBKDF2WithHmacSHA1"
    let iv = "8119745113154120"

    let cryptLib = CryptLib()

    let cipherText = cryptLib.encryptPlainText(plainText, key: key, iv: iv)
    print("cipherText \(cipherText! as String)")

    let decryptedText = cryptLib.decryptCipherText(cipherText!, key: key, iv: iv)

    print(decryptedText)

This is the output:

cipherText fcb27GSZEKusGzvEMwZuH9rFOwlfGWleDWQC4EM9x68= decryptedText }5-sn9>)>yiu;/) text

Please help

/// UPDATE////

Guys i found the issue 👍

replace decrypt cipher text function with this