Skip to content

Instantly share code, notes, and snippets.

View OlexandrStepanov's full-sized avatar

Oleksandr Stepanov OlexandrStepanov

View GitHub Profile
@OlexandrStepanov
OlexandrStepanov / ParseDERCertificate.swift
Created November 2, 2019 21:25
SecCertificate and SecKey from DER certificate in base64
let crtBase64 = "..."
if let certificateData = Data(base64Encoded: crtBase64, options: []),
let certificate = SecCertificateCreateWithData(nil, certificateData as CFData) {
// use certificate to initialize PinnedCertificatesTrustEvaluator, or ...
var trust: SecTrust?
let policy = SecPolicyCreateBasicX509()
let status = SecTrustCreateWithCertificates(certificate, policy, &trust)
@OlexandrStepanov
OlexandrStepanov / gist:852cd62344dab498b1baec28bbc59145
Created October 8, 2019 09:39
Swift protocol extension example
import UIKit
protocol AppNavigationProtocol {
var appDelegate: AppDelegate { get }
}
extension AppNavigationProtocol {