A collection of secure socket layer utilities written in Swift using openSSL.
SecureSockets is part of the Swiftfire webserver project.
The reference manual
(Never mind the github report that it is mostly C, that report is misleading because of openssl include files)
OpenSSL is available from https://openssl.org.
For convenience pre-compiled openSSL distributions are included in this package. While this is convenient for evaluation and development purposes, you should not use them for the final production version of your application. You owe it to your clients/users to only use fully guaranteed openSSL libraries. Which you have to build yourself.
Instructions are included in Installing OpenSSL.
Note on iOS and tvOS usage: While SecureSockets does build for these platforms, we ourselves have not used it on these platforms. Also we have no guidelines on how to integrate it into an iOS/tvOS project. In addition it will be necessary to cross-compile openSSL for these platforms, a task that is made easier by the script at OpenSSL-for-iPhone.
If you have used SecureSockets on iOS or tvOS, and are willing to share the process on how to do so, please let us know at: [email protected].
The manifest file Package.swift
has been prepared with a dependency build in mind. Hence it must be edited to build to a stand-alone SecureSockets target.
When SecureSockets is build as stand-alone product the installation is as follows:
$ git clone https://github.com/balancingrock/SecureSockets.git
$ cd SecureSockets
<<edit Package.swift>>
$ swift build
The step <<edit Package.swift>>
is to un-comment either the openssl linux libraries or the openssl macOS libaries.
SecureSockets can be used by the Swift Package Manager. Just add it to your package manifest as a dependency.
To build the project that uses SecureSockets add the following options to the build command:
$ swift build -Xswiftc -I/<<path>>/openssl/<<version-platform>>/include -Xlinker -L/<<path>>/openssl/<<version-platform>>/lib
where <<path>>
must be set to the proper value and <<version-make>>
to the openssl version and the platform necessary.
Alternatively it may be possible to include these in the product manifest.
The Swiftfire project is used as an example.
Clone the project repository and create a Xcode project:
$ git clone https://github.com/Balancingrock/Swiftfire.git
$ cd Swiftfire
$ swift package generate-xcodeproj
Double click the project to open it.
In the navigator select Swiftfire
, then under Targets
select CopensslGlue
then select Build Settings
Linking
add the value -lssl -lcrypto
to Other Linker Flags
.Search Paths
add the value $(SRCROOT)/openssl/v1_1_1g-macos_10_15/lib
to Library Search Paths
Search Paths
add the value $(SRCROOT)/openssl/v1_1_1g-macos_10_15/include
to Header Search Paths
(be sure to leave a blank character between the content that was already present and the additional content)In the navigator select Swiftfire
, then under Targets
select SecureSockets
then select Build Settings
Search Paths
add the value $(SRCROOT)/openssl/v1_1_1g-macos_10_15/include
to Header Search Paths
(be sure to leave a blank character between the content that was already present and the additional content)The build process should now be able to complete.
No new features planned. Updates are made on an ad-hoc basis as needed to support Swiftfire development.
link |
Stars: 5 |
Last commit: 3 years ago |
Swiftfire -and all its supporting packages- have been issued in their release 1.0.0
SecureSockets has undergone some file-renaming and some reorganization. Otherwise the functionality itself is unchanged.
Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics