Swiftpack.co - svdo/swift-SelfSignedCert as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by svdo.
svdo/swift-SelfSignedCert 3.1.0
A framework for iOS that allows creating self-signed certificates, implemented in Swift.
⭐️ 42
🕓 2 years ago
iOS macOS tvOS
.package(url: "https://github.com/svdo/swift-SelfSignedCert.git", from: "3.1.0")

SelfSignedCert

Swift Version 5 CocoaPods Version Badge License Badge Supported Platforms Badge Carthage compatible Swift Package Manager compatible

This project provides a Swift framework that allows you to create self-signed certificates on iOS, using Swift. Unfortunately, Apple does not provide this functionality in their security frameworks. Another way of doing it is using OpenSSL, but (especially when using Swift) that is downright horrible.

The code in this library is a (partial) port of MYCrypto. That project contains unmaintained Objective-C code, which was difficult to use as a CocoaPod and especially also when using Swift. So I took that part that I needed and implemented that in Swift.

Please note that I'm not a security expert. This framework has not been reviewed by a security expert. Until it has, please use with caution! And in any case (reviewed or not), using it is always at your own risk of course.

If you are a security expert and you want to review this framework, please contact me.

Usage

guard let identity = SecIdentity.create(
    subjectCommonName: "common name",
    subjectEmailAddress: "[email protected]") else {
    return
}

This will give you a self-signed SecIdentity? that is already stored in the keychain. See also SecIdentity+SelfSigned.swift for functions to retrieve previously created identities from the keychain.

Related Library

You may want to have a look at swift-SecurityExtensions for some helpers to more easily use SecIdentity, SecCertificate, and SecKey.

GitHub

link
Stars: 42
Last commit: 1 year ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics