how to add openssl to a swift project - swift

I am learning how to add in-app purchase receipt validation to my iOS/OSX projects.
There is a nice overview here and the WWDC14 has good videos on this topic.
Plenty of sample code, but everyone skips one step. How to import the openSSL header. The swift compiler complains that there is no such module.
import Foundation
import StoreKit
import openssl //no such module ???
I am already stuck before writing one line of code. Where is the openssl framework hiding?

There is no OpenSSL module built in. You have to compile it yourself - this is for security so that everyone doesn't implement the exact same security.
Take a look at :
https://gist.github.com/foozmeat/5154962
http://www.cvursache.com/2013/08/13/How-To-Build-openssl-For-iOS/
There is a also a cocoapods at http://cocoapods.org/?q=openssl
You should never use a static module provided by someone else. Always build your own.
Apples official explanation here - under OpenSSl - https://developer.apple.com/library/ios/documentation/Security/Conceptual/cryptoservices/GeneralPurposeCrypto/GeneralPurposeCrypto.html

Related

2sxc App Export/Import - Web Log app modified to a Book Reading Log

Environment(s) DNN 9.10.2 / 2sic_2SexyContent_14.07.04 Install / Oqtane 3.1.4
I've modified the 2sxc Blog module 4 to be a book reading log.
I've created 608 entries and wish to export/import to Oqtane 3.1.4 site.
I attempted the export from 2sxc without noting the module version and when importing the data I get the following error:
Could not import the app / package: Sequence contains more than one matching element.
This is similar to https://github.com/2sic/2sxc/issues/460.
I've even installed 2sxc on another vanilla DNN 9.10.2 site and attempted the import on that (with the latest version of 2sxc 14.7.4 and get the same error.
I've seen in the Github issue noted above you could analyze the import process in your development environment? If so I'd be happy to send you the import zip file created from the App Export feature in 2sxc App Settings.
I have looked pretty deeply for any guidance on configuring the development environment for 2sxc and haven't been able to find anything. Also does anyone have good guidance on how to set up a development environment for the 2sxc modules? Would be great to include steps to set this up in Oqtane as I am moving all of my development energy moving forward to Oqtane module development - Oqtane is the next logical step for DNN Developers.
And also goes without saying that 2sxc is one of the best modules ever for DNN and offers a migration path away from DNN when you find that time coming. I've just gotten my Epiphany moment with Oqtane 3.1.4 realizing it is about at the same point DNN 2.1.2 was - a mature, extensible framework from which to build your .NET Core apps with.
It's great to hear others are experimenting with Oqtane - awesome!
Your first step should be to check the insights log on the API call that does the import. It will probably show you exactly where it failed.
My guess is that it has to do with languages which are enabled / disabled differently in Dnn and Oqtane.

Failed to build module 'XXX' from its module interface while creating xcframework

Currently I am working in a framework project to distribute to a client we have. The Framework has SPM dependencies and I wanted to create an XCFramework from it. I found the scripts to archive and generate the XCFramework with the xcodebuild tool. The problem is that the generation is not working and I get the following error Failed to build module 'XXX' from its module interface; it may have been damaged or it may have triggered a bug in the Swift compiler when it was produced. I don't know if it is possible to build a framework with SPM dependencies as an XCFramework I was trying to distribute it as binary framework to protect our source code. I previously looked for this but couldn't found any information in the matter. Can somebody help me?
One solution seems to add #_implementationOnly import for the modules from the third-party SDKs. This should fix your XCframework error if you aren't using anything from that SDK as part of your module's public interface.

Compiling unsupported module into Linux-based Swift project

I need to import the Apple GameController framework for a server-side Swift project running on Linux (where that framework is unsupported). I do not need the GameController functionality, which used by my code on other platforms - I just need to get my project to compile so I can use the unrelated parts of the code base.
What is the best approach for handling this situation?

Could Not Build Objective-C Module BranchInvite

I've installed the BranchInvite framework as a pod, it's up to date. My project even recognizes, and tries to autocomplete, the module when I try to import it but the throws the error Could Not Build Objective-C Module BranchInvite
This post, the only one I could find, did not solve the problem as I tried to import each piece in my bridging header: Swift 'Could not build Obj-C module 'BranchInvite'
I've uninstalled, reinstalled the pods. No dice. I'm running Xcode 7.1 and Swift 2.1, is this a generic issue or what could be possible work arounds/solutions?
On a side note, I would love to not have to do all of the UI and wiring involved in sending in-app invites. I can and I will but it would be a huge time saver not to. That's one of the reasons Branch was so appealing. If there aren't any solutions are there any other deep-link services that also offer out-of-the-box UI?

OpenSSL on iPhone

I need to figure out how to get two OpenSSL functions for iPhone. I'm trying to keep it so I don't need another dylib, because I don't want Apple to reject my application for something so silly.
Anyways, I have an app that access an API, not one of my APIs, so I can't really change it, and also, I don't want anyone to know my public key, or use this specific 'private' api, so I can't just make a PHP script server side, which, would be easier, except that it just won't work out.
I need to be able to use something that will seal a request in OpenSSL, and also encode a public key in OpenSSL. I have the headers, and I can't seem to figure anything out.
Generally, the easiest approach to encryption and decryption on the iPhone is the Security.framework, instead of using OpenSSL directly.
See here:
http://developer.apple.com/iphone/library/DOCUMENTATION/Security/Conceptual/CertKeyTrustProgGuide/iPhone_Tasks/iPhone_Tasks.html#//apple_ref/doc/uid/TP40001358-CH208-SW9
The example at the bottom (listings 2-8, 2-9 and 2-10) show RSA-1024 key pair creation plus encryption and decryption.
By using a different key, you can control the encryption/decryption method to match the requirements of your server.
You can also compile OpenSSL as a library for iOS. Here is an tutorial from me:
http://www.x2on.de/2010/07/13/tutorial-iphone-app-with-compiled-openssl-1-0-0a-library/
For me I found that implementing the OpenSSL pod from cocoapods was the easiest. No tutorial needed.
Info: http://cocoapods.org/?q=openssl
-> OpenSSL (1.0.1)
OpenSSL is an SSL/TLS and Crypto toolkit. Deprecated in Mac OS and gone in iOS, this spec gives your project non-deprecated OpenSSL support.
pod 'OpenSSL', '~> 1.0.1'
- Homepage: http://www.openssl.org/
- Source: https://github.com/endSly/OpenSSL-pod.git
- Versions: 1.0.1, 1.0.0 [master repo]