GitHunt
NT

ntnmrndn/FoundationURLPubKeyExtractor

Easy way to extract the hash of a public key from a domain on iOS/macOS

FoundationURLPubKeyExtractor

Easy way to extract a public key from a domain on iOS/macOS

Usage:

PubKeyExtractor.getPubKey(url: url, completion: {
    switch $0 {
    case .success(let key):
        print("pubKey: \(key.base64)")
    case .failure(let error):
        print("Could not get key because \(error)")
    }
})

Note:

The results will differ from the .pem because .pem include some headers.

Motivations:

Assess the impact of pubkey pinning techniques

Todo: macOS compat (should take a few minutes...)

Cocoapods:

pod 'URLPubKeyExtractor'

Languages

Swift77.4%Ruby22.6%

Contributors

MIT License
Created September 29, 2020
Updated January 30, 2026
ntnmrndn/FoundationURLPubKeyExtractor | GitHunt