robbiehanson / CocoaAsyncSocket

Asynchronous socket networking library for Mac and iOS
Other
12.45k stars 3k forks source link

How to decrypt CocoaAsyncSocket with AES-256-CFB mode #425

Closed whisper-bye closed 8 years ago

whisper-bye commented 8 years ago

I created an app with CocoaAsyncSocket, I want to decrypt the data form the server

func socket(sock: GCDAsyncSocket!, didReadData data: NSData!, withTag tag: Int) {
    // here to decrypt...
}

everything works fine, but often garbled

I am using CCCrypt method, I guess it is because the read block size is incorrect, the didReadData method don't read data complete at once.

my question is, what the correct way to decrypt CocoaAsyncSocket with AES-256-CFB mode

chrisballinger commented 8 years ago

You should be using TLS instead.

On Sat, Apr 30, 2016 at 10:58 AM, whisper-bye notifications@github.com wrote:

I created an app with CocoaAsyncSocket, I want to decrypt the data form the server

func socket(sock: GCDAsyncSocket!, didReadData data: NSData!, withTag tag: Int) { // here to decrypt... }

everything works fine, but often garbled

I am using CCCrypt method, I guess it is because the read block size is incorrect, the didReadData method don't read data complete at once.

my question is, what the correct way to decrypt CocoaAsyncSocket with AES-256-CFB mode

— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub https://github.com/robbiehanson/CocoaAsyncSocket/issues/425

whisper-bye commented 8 years ago

@chrisballinger Thanks for your answer, But I am using a private protocol, the server returns encrypted data. I just want to know the right way to decrypt the data, Could you please give me some advice? thx!

Dirk- commented 8 years ago

This is what I do (Objective-C and RNCryptor, with AES256):

Best regards, Dirk

Am 30.04.2016 um 21:42 schrieb whisper-bye notifications@github.com<mailto:notifications@github.com>:

@chrisballingerhttps://github.com/chrisballinger Thanks for your answer, But I am using a private protocol, the server returns encrypted data. I just want to know the right way to decrypt the data, Could you please give me some advice? thx!

— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHubhttps://github.com/robbiehanson/CocoaAsyncSocket/issues/425#issuecomment-215989633

whisper-bye commented 8 years ago

thx all, I have figured it out, because I release the context