2011-04-28 23 views
1

我想通過郵政方式發送信用卡號碼,但信用卡號碼應採用加密形式。如何加密它。請幫幫我。如何在iphone中加密信用卡號碼

我的代碼是:

NSString *fName = firstName.text; 
NSString *lName = lastName.text; 
NSString *phone = phoneNumber.text; 
NSString *emailid = email.text; 
NSString *cardNumber = creditCardNumber.text; 
NSString *ID = particularEventPaidId; 
NSString *postData = [NSString stringWithFormat:@"id=%@&firstname=%@&lastname=%@&phone=%@&email=%@&creditcard=%@",ID,fName,lName,phone,emailid,cardNumber]; 
NSString *postLength = [NSString stringWithFormat:@"%d", [postData length]]; 
NSLog(@"postLength is: %@",postLength); 

NSURL *url = [NSURL URLWithString:@"http://cfcdi.org/eassociation/web-service/event-register.php"]; 
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url]; 
[request setHTTPMethod:@"POST"]; 
NSData *requestBody = [postData dataUsingEncoding:NSUTF8StringEncoding allowLossyConversion:YES]; 
[request setValue:postLength forHTTPHeaderField:@"Content-Length"]; 
[request setHTTPBody:requestBody]; 
[request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"content-type"]; 
NSURLResponse *response; 
NSError *requestError; 
[NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&requestError]; 

if(requestError==nil) 
    NSLog(@"Error is nil"); 
else 
    NSLog(@"Error is not nil"); 
NSLog(@"success!"); 
在上面,我要發送加密形式的信用卡號碼

在此先感謝:

+3

如果你要問,做別的事情; http://stackoverflow.com/questions/805324/what-options-are-available-to-accept-credit-card-payments-through-an-iphone - 這樣做有不小的pa-dss/pci-dss影響 – 2011-04-28 13:07:54

+0

同意,避免頭痛,你將不得不擔心向蘋果提供有關加密的文檔,你將負責信用卡信息的安全性,如果你曾經被黑客入侵,可能會導致嚴重的法律問題。堅持已經在做的大傢伙。 – Joe 2011-04-28 13:13:45

+0

我同意亞歷克斯和喬:如果你不得不問這個關於加密的基本問題,你還沒有準備好處理信用卡所涉及的複雜問題。這是一個粗糙的世界,只是問索尼。 – 2011-04-28 13:29:45

回答