Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6113433
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T14:51:31+00:00 2026-05-23T14:51:31+00:00

I searched around for hours to find something that might help me with what

  • 0

I searched around for hours to find something that might help me with what im trying to do but couldn’t find anything that I got to work.

Basically what I am trying to do is encrypt the login credentials (username and password) in my iPhone application, send them to a php file on my server, decrypt them and validate the contents in a database.

I am pretty well versed in iPhone development but far from confidant with anything cryptography/security related. I think I am doing the local iphone encryption correctly as well as sending the blob of encrypted data correctly but have no idea where to begin on the php decryption side.

Heres some of the code im using

NSString* stringTo = @"Test Encoding String";
NSString* key = @"1234567812345678";
NSData* encrypedData = [[stringTo dataUsingEncoding:NSUTF8StringEncoding] AES256EncryptWithKey:key];

NSString* decrypt = [[NSString alloc] initWithData:[encrypedData AES256DecryptWithKey:key] encoding:NSUTF8StringEncoding];
NSLog(@"\nDECRYPT :%@", decrypt); // DOES RETURN THE SAME VALUE


NSString *urlString = @"SERVERNAME/FILE.php";

NSMutableURLRequest *request = [[[NSMutableURLRequest alloc] init] autorelease];
[request setURL:[NSURL URLWithString:urlString]];
[request setHTTPMethod:@"POST"];

NSString *boundary = [NSString stringWithString:@"---------------------------14737809831466499882746641449"];
NSString *contentType = [NSString stringWithFormat:@"multipart/form-data; boundary=%@", boundary];
[request addValue:contentType forHTTPHeaderField:@"Content-Type"];

NSMutableData *body = [NSMutableData data];

[body appendData:[[NSString stringWithFormat:@"\r\n--%@\r\n", boundary] dataUsingEncoding:NSUTF8StringEncoding]];
[body appendData:[[NSString stringWithString:@"Content-Disposition: form-data; name=\"encryptedString\"\r\n\r\n"] dataUsingEncoding:NSUTF8StringEncoding]];
[body appendData:encrypedData];
[body appendData:[[NSString stringWithFormat:@"\r\n--%@--\r\n", boundary] dataUsingEncoding:NSUTF8StringEncoding]];

[request setHTTPBody:body];

NSData *returnData = [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil];
NSString *returnString = [[NSString alloc] initWithData:returnData encoding:NSUTF8StringEncoding]; 
NSLog(@"RS: %@", returnString);

Thanks a lot for any help. Ive been looking for a while and haven’t found anything that worked for me. Thought their would be more out there with a similar question to me since it seems like something that would be commonly used.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T14:51:31+00:00Added an answer on May 23, 2026 at 2:51 pm

    First, why do you need to send the password to the server encrypted? Why not just send it over an SSL connection and then have the server verify that the password matches against the password hashes in the database? Also, there should be no need to encrypt the username. Just the password.

    In order to encrypt and then decrypt, you are going to need some sort of encryption key or passphrase that you can memorize. I would recommend storing your password encrypted on the iPhone and then simply a hash of it on the server. You can use php’s crypt() functions to easily create the hashes and store them in a database.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

ive searched around but couldnt really find anything to help. I use this code
I searched around but couldn't find exactly what I'm looking for. I have a
I searched around a little bit for information on this but didn't find anything
I've searched around online but can't find what I'm after. Basically, during an install,
I've searched around for a bit, but haven't been able to find anything useful
The question is in the title... I searched but couldn't find anything. Edit: I
I searched around but couldn't find an answer. I'm not sure if this is
I searched around and couldn't find a solution to this problem. I am trying
I searched around a bit and couldn't find anything clear cut as to whether/how
I've searched around but I can't find any information about this; maybe I'm not

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.