BlueRSA icon indicating copy to clipboard operation
BlueRSA copied to clipboard

Update to use SecKeyCreateRandomKey

Open LowAmmo opened this issue 3 years ago • 3 comments

iOS 15.0 deprecated SecKeyGeneratePair, so would appreciate updating to SecKeyCreateRandomKey to eliminate a warning.

Pretty easy to change over -

    var privateKey: SecKey?
    var publicKey: SecKey?

    do {
        var error: Unmanaged<CFError>?

        // The keys are automatically stored in the keychain
        guard let privKey = SecKeyCreateRandomKey(attributes as CFDictionary, &error) else {
            throw error!.takeRetainedValue() as Error
        }
        privateKey = privKey
        publicKey = SecKeyCopyPublicKey(privateKey!)
    } catch {
        ulog.error(error: error, "Error creating public/private keys")
    }

LowAmmo avatar Sep 28 '22 21:09 LowAmmo

@LowAmmo Thanks! Please submit a PR

dannys42 avatar Sep 30 '22 05:09 dannys42

@dannys42 - Sure, I'll work on putting one together!

LowAmmo avatar Sep 30 '22 16:09 LowAmmo

@dannys42 - Created pull request (above)

As a note...wasn't sure about versioning. Went ahead and upped the version of the podspec in the PR...but not sure if that was the right way to do it...

LowAmmo avatar Sep 30 '22 18:09 LowAmmo