开发者

how to send "Secure SMS" from iPhone

I am developing an iPhone application which requires the sending of an "Secure SMS", i am able ot send the sms from within our application using MFMessageComposeViewController method, but i am not getting any help on how we can send an SMS securily like the text should be encrypted from client side(iPhone) and it should be decrypted at server side and also vice versa.

any sample code or ideas would be appreciated.

thank开发者_如何学JAVAs shiva.


http://septicus.com/products/opensource/ is a valuable resource that let you use openSSL in Cocoa environment.


from main.m of SSCrypt framework

// generate a private key
NSData *privateKeyData = [SSCrypto generateRSAPrivateKeyWithLength:2048];
// generate a public key from the private key data
NSData *publicKeyData = [SSCrypto generateRSAPublicKeyFromPrivateKey:privateKeyData];

And

crypto = [[SSCrypto alloc] initWithPublicKey:publicKeyData privateKey:privateKeyData];

NSString *topSecret = @"Billy likes Mandy";
[crypto setClearTextWithString:topSecret];

NSData *encryptedTextData = [crypto encrypt];
NSData *decryptedTextData = [crypto decrypt];

NSLog(@"Top Secret: %@", topSecret);
NSLog(@"Encrypted: %@", [encryptedTextData encodeBase64]);
NSLog(@"Decrypted: %s", [decryptedTextData bytes]);

[crypto release];


There's absolutely no way for you to control what happens to the SMS data you send after you dismiss MFMessageComposeViewController. Once it's sent, the receiver will simply receive the SMS message, and no app can control what else happens.


As for the question, your going to have to do the encryption on your own using most likely public/private key encryption, such as RSA.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜