Skip to content
This repository has been archived by the owner on Jun 9, 2021. It is now read-only.

IOS Failes to decrypt VB.net String #22

Open
mld54444 opened this issue Apr 25, 2019 · 5 comments
Open

IOS Failes to decrypt VB.net String #22

mld54444 opened this issue Apr 25, 2019 · 5 comments

Comments

@mld54444
Copy link

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
Copy link

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

@skavinvarnan
Copy link
Owner

@tarakinsuide processed in VB.net?

@tarakinsuide
Copy link

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
Copy link
Owner

@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
Copy link

reunitedaditya commented Apr 27, 2020

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

  • (NSString *) decryptCipherText:(NSString *)ciperText key:(NSString *)key iv:(NSString *)iv {
    return [[NSString alloc] initWithData:[[CryptLib alloc] decrypt:[[NSData alloc] initWithBase64EncodedString:ciperText options:NSDataBase64DecodingIgnoreUnknownCharacters] key:[[CryptLib alloc] sha256:key length:32] iv: iv] encoding:NSUTF8StringEncoding];
    }

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants