iOS服务器端使用AES解密(需要了解的参数)

发布于 2025-01-01 13:14:34 字数 880 浏览 3 评论 0原文

我的 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

冷弦 2025-01-08 13:14:34

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文