支持AES 256与GCM不可能在iOS? [英] Support of AES 256 with GCM not possible in iOS?

查看:2188
本文介绍了支持AES 256与GCM不可能在iOS?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前,加密模式支持 AES 256是CBC 。但是我想使用 AES 256加密 GCM 模式以及 PKCS5Padding / PKCS7Padding

Currently the encryption mode supported with AES 256 is CBC. But I want to use AES 256 encryption with GCM mode along with PKCS5Padding / PKCS7Padding.

让我知道如何完成?

推荐答案

Common Crypto不支持GCM。但是在Security.framework中有一个AES GCM的实现,您可以添加自己的头文件来使用它。但是,关联数据(AEAD)不起作用。

Common Crypto does not support GCM. But there is an implementation of AES GCM in the Security.framework, and you can add your own header file to use it. However associated data (AEAD) does not work.

SO答复< a> by soyer:

From SO Answer by soyer:

CCCryptorStatus CCCryptorGCM(
                 CCOperation     op, // kCCEncrypt, kCCDecrypt
                 CCAlgorithm     kCCAlgorithmAES,
                 const void      *key,    size_t  keyLength,
                 const void      *iv,     size_t  ivLen,
                 const void      *aData,  size_t  aDataLen, // does not work
                 const void      *dataIn, size_t  dataInLength,
                 void            *dataOut,
                 const void      *tag,    size_t *tagLength);

有一个实现 AES GCM 在github上,与Common Crypto相比,似乎合理的albiet缓慢。使用您自己的风险。

There is an implemntation AES GCM on github that seems reasonable albiet slow in comparison to Common Crypto. Use at your own risk.

这篇关于支持AES 256与GCM不可能在iOS?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆