English 中文(简体)
• 将UTF8的16个 by与SecKeyWrapper断裂(ccStatus=4304)
原标题:Encrypting 16 bytes of UTF8 with SecKeyWrapper breaks (ccStatus == -4304)
最佳回答

以下各行......

// We don t want to toss padding on if we don t need to
if (*pkcs7 != kCCOptionECBMode) {
  if ((plainTextBufferSize % kChosenCipherBlockSize) == 0) {
*pkcs7 = 0x0000;
  } else {
    *pkcs7 = kCCOptionPKCS7Padding;
  }
}

......是我问题的主人。 为了解决这个问题,我只得说几句。

As far as I can tell, the encryption process was not padding on the encryption side, but was then still expecting padding on the decryption side, causing the decryption process to fail (which is generally what I was experiencing).

用于加密/加密的“kCCOptionPKCS7Patter的航道目前对我来说是行之有效的:符合length % 16 = 0的星体。 这也是对<代码>的修改。 SecKeyWrapper <代码>CryptoExercise>example代码。 无法确定使用<条码>Crypto<> 代码/代码>的您与家用制片人有何影响。

问题回答

我也曾使用通用语组,但对于长度超过16倍的纽约州,我也遇到了这一问题。

我的解决办法是完全 ha的,因为我尚未找到解决问题的真正办法。

如果是16个多块空间,我就把我的座落在最后。 这符合我的具体设想,因为数据的额外空间不会影响对方数据的接收,但我怀疑它会为其他假设情况的人工作。

希望一些人会说,我们正确的方向是找到真正的解决办法。





相关问题
List Contents of Directory in a UITableView

I am trying to list the contents of Ringtones directory in a TableView, however, I am only getting the last file in the directory in ALL cells, instead of file per cell. This is my code: - (...

iPhone NSUserDefaults persistance difficulty

In my app i have a bunch of data i store in the NSUserdefaults. This information consists of an NSObject (Object1) with NSStrings and NSNumbers and also 2 instances of yet another object (Object2). ...

Writing a masked image to disk as a PNG file

Basically I m downloading images off of a webserver and then caching them to the disk, but before I do so I want to mask them. I m using the masking code everyone seems to point at which can be found ...

Resize UIImage with aspect ratio?

I m using this code to resize an image on the iPhone: CGRect screenRect = CGRectMake(0, 0, 320.0, 480.0); UIGraphicsBeginImageContext(screenRect.size); [value drawInRect:screenRect blendMode:...

Allowing interaction with a UIView under another UIView

Is there a simple way of allowing interaction with a button in a UIView that lies under another UIView - where there are no actual objects from the top UIView on top of the button? For instance, ...

热门标签