From 5ced6151c2f00b4e9f57d542690c95b0cfbbf19a Mon Sep 17 00:00:00 2001 From: James Magahern Date: Thu, 15 Nov 2018 16:30:25 -0800 Subject: [PATCH] Some additional headers needed to decrypt the payload --- kordophone/Crypto/GCDWebServerDataResponse+Crypto.m | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/kordophone/Crypto/GCDWebServerDataResponse+Crypto.m b/kordophone/Crypto/GCDWebServerDataResponse+Crypto.m index 99a76dd..793b83a 100644 --- a/kordophone/Crypto/GCDWebServerDataResponse+Crypto.m +++ b/kordophone/Crypto/GCDWebServerDataResponse+Crypto.m @@ -30,7 +30,15 @@ static NSString *const kSymmetricKey = @"axPy0nljtG/TOVJSVwVXag=="; NSLog(@"Error encrypting response: %@", error); } - return [[self alloc] initWithData:encryptedData contentType:@"application/octet-stream"]; + NSString *ivDataString = [ivData base64EncodedStringWithOptions:0]; + + GCDWebServerDataResponse *response = [[self alloc] initWithData:encryptedData contentType:@"application/octet-stream"]; + [response setValue:ivDataString forAdditionalHeader:@"X-KordophoneCrypto-IV"]; + + // TODO: is this the right way?? + [response setValue:[NSString stringWithFormat:@"%lu", (unsigned long)[data length]] forAdditionalHeader:@"X-Decrypted-Content-Length"]; + + return response; } @end