INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

objective-c how to remove encryption from this code

objective-c how to remove encryption from this code

objective-c how to remove encryption from this code

(OP)
Hi

I am very new to objective-c and am finding it to be a very difficult to fully grasp how it works.

Anyways, the code below retrieves an encrypted xml plist file from my server and then decrypts for use in my iPhone app. But I just discovered that encryption is whole big issue that I really don't want to deal with right now, so I need to remove the encryption part (I have no problem doing that on server side).

So currently it's this:
SERVER SIDE: XML Plist file > Encrypt > Base64encode
IPHONE SIDE: request and receive file > base64decode > decrypt > XML Plist file.

I need to remove the decrypt part, so it's like this:
SERVER SIDE: XML Plist file > Base64encode
IPHONE SIDE: request and receive file > base64decode > XML Plist file.

I have played with this code but can't get it right. Any help appreciated. I am sure it's something to do with SecKeyWrapper, but not able to remove it.

Thanks

CODE

-(void)sync{
    NSURL *url = [NSURL URLWithString:@"http://www.mydomain.com/plist-settings.php"];
    NSURLRequest *request = [NSURLRequest requestWithURL:url cachePolicy:NSURLRequestReloadIgnoringLocalCacheData timeoutInterval:5.0];    
    [NSURLConnection connectionWithRequest:request delegate:self];
    sync_data = [[NSMutableData alloc] init];
}

- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)_data{
    [sync_data appendData:_data];
}

- (void)connectionDidFinishLoading:(NSURLConnection *)connection{
    char * key = "(mASFi14%12As./*";
    NSData * symmetricKey = [NSData dataWithBytes:key length:16];
    CCOptions pad = kCCOptionECBMode;
    
    NSMutableData *theData = [[NSData dataFromBase64String:[[NSString alloc] initWithData:sync_data encoding:NSUTF8StringEncoding]] mutableCopy];
    if ([theData length] == 0) {
        [theData release];
        return;
    }

    sync_data = [[[SecKeyWrapper sharedWrapper] doCipher:theData key:symmetricKey context:kCCDecrypt padding:&pad] mutableCopy];

    [theData release];
    
    NSDictionary *dictServer = nil;
    CFPropertyListRef plist = CFPropertyListCreateFromXMLData(kCFAllocatorDefault, (CFDataRef)sync_data, kCFPropertyListImmutable, NULL);

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close