尝试构建SSCrypto框架以与iOS配合使用时构建失败

编程入门 行业动态 更新时间:2024-10-28 20:31:17
本文介绍了尝试构建SSCrypto框架以与iOS配合使用时构建失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

使用Xcode 4,我试图构建SSCrypto框架以用于iOS应用程序。

Using Xcode 4, I'm attempting to build the SSCrypto framework for use with an iOS app.

在版本设置中,当我将基本SDK更改为最新iOS时,会出现以下错误:

In Build Settings, when I change the base SDK to Latest iOS, I get this error:

target specifies product type 'com.apple.product-type.framework', but there's no such product type for the 'iphoneos' platform

我的搜索和搜索已经变空了,所以我觉得我缺少一些明显的东西...

My googling and searching has turned up empty, so I feel I'm missing something obvious...

如何获得SSCrypto框架在iOS上的工作?

How do I get SSCrypto framework to work on iOS?

推荐答案

对于iOS只能使用静态库,库。

For iOS only static libraries can be used, not frameworks with dynamic libraries.

而是使用CommonCrypto,它是纯C,但不是真的很难使用。确保您使用所有相同的设置,模式,IV(如果必要的模式),填充和键。

Instead use CommonCrypto, it is plain C but not really hard to use. Do insure that you use all the same setting, mode, IV (if necessary for the mode), padding and key.

添加安全。框架到项目

#import <CommonCrypto/CommonCryptor.h> + (NSData *)doCipher:(NSData *)dataIn iv:(NSData *)iv key:(NSData *)symmetricKey context:(CCOperation)encryptOrDecrypt { CCCryptorStatus ccStatus = kCCSuccess; size_t cryptBytes = 0; // Number of bytes moved to buffer. NSMutableData *dataOut = [NSMutableData dataWithLength:dataIn.length + kCCBlockSizeAES256]; ccStatus = CCCrypt( encryptOrDecrypt, kCCAlgorithmAES256, kCCOptionPKCS7Padding, symmetricKey.bytes, kCCKeySizeAES256, iv.bytes, dataIn.bytes, dataIn.length, dataOut.mutableBytes, dataOut.length, &cryptBytes); if (ccStatus != kCCSuccess) { // Handle error NSLog(@"CCCrypt status: %d", ccStatus); } dataOut.length = cryptBytes; return dataOut; }

对于Base64,请参阅:回答

For Base64 see: SO answer

更多推荐

尝试构建SSCrypto框架以与iOS配合使用时构建失败

本文发布于:2023-11-24 03:05:39,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1623746.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:框架   SSCrypto   iOS

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!