iOS服务器端使用AES解密(需要了解的参数)
我的 iOS 应用程序中有一个注册过程,用户需要注册自己才能登录。因此,我通过肥皂请求将此数据发送到服务器,现在我想做的是在发送到服务器之前对数据进行加密服务器,我知道iOS使用AES加密机制来加密数据,它有CCCryptor.h文件,我使用了这段代码,
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.
[self.window makeKeyAndVisible];
NSString *plainString = @"Hello Rob,Hello joseph";
NSString *key = @"123456";
NSLog( @"Original String: %@", plainString );
NSString *encryptedString = [plainString AES256EncryptWithKey:key];
NSLog( @"Encrypted String: %@", encryptedString );
NSLog( @"Decrypted String: %@", [encryptedString AES256DecryptWithKey:key] );
return YES;
}
这段代码工作完美,我得到了正确的输出,如果我将此加密数据传递到服务器,这应该如何在服务器端解密是我的疑问。(使用什么参数)
我们还可以在我的例子中使用简单的密码技术吗?
所以朋友们,请帮帮我。
问候 兰吉特
I have a registration process in my iOS app where the user is required to register himself or herself to login.So, I am sending this data to server,through soap requests,now what I want to do is encrypt the data before sending this to server, I got to know that iOS uses AES encryption mechanism to encrypt the data and it has CCCryptor.h files and i used this code
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.
[self.window makeKeyAndVisible];
NSString *plainString = @"Hello Rob,Hello joseph";
NSString *key = @"123456";
NSLog( @"Original String: %@", plainString );
NSString *encryptedString = [plainString AES256EncryptWithKey:key];
NSLog( @"Encrypted String: %@", encryptedString );
NSLog( @"Decrypted String: %@", [encryptedString AES256DecryptWithKey:key] );
return YES;
}
this code works perfectly and I get correct outputs,if I pass this encrypted data to server,how this should be decrypted on server side is my doubt.(What parameters to use)
Also can we use a simple passphrase technique in my case ?
So friends,please help me out.
Regards
Ranjit
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
AES 是对称密钥加密。这意味着两端应该使用相同的密钥加密/解密。这里您的密钥“123456”将被服务器用来解密。但是将密钥与加密字符串一起发送并不安全。
AES is the symetric key encryption. Which means both ends should use same key encrypt / decrypt. Here your key "123456" is to be used by the server to decrypt. But sending key along with encrypted string is no way secure.