agens-no / EllipticCurveKeyPair

Sign, verify, encrypt and decrypt using the Secure Enclave
Other
708 stars 114 forks source link

SecItemCopyMatching not works in iphone 12 #53

Open MajidAlNuumani opened 3 years ago

MajidAlNuumani commented 3 years ago

I face issue with Face Id in some of iphone 12 pro and pro max the issue happen in SecKeyCreateSignature not generate signature but it works fine in different iphones like iphone 11.

even I cannot get the Face Id prompt.

my app not show in Face id & Passcode -> other apps.

In iphone 12 pro not in all device happen only a few devices.

hfossli commented 3 years ago

Threading issues?

Håvard

  1. jan. 2021 kl. 11:20 skrev MajidAlNuumani notifications@github.com:

 I face issue with Face Id in some of iphone 12 pro and pro max the issue happen in SecKeyCreateSignature not generate signature but it works fine in different iphones like iphone 11.

even I cannot get the Face Id prompt.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.

MajidAlNuumani commented 3 years ago

I am not sure but here is my code:

Singing data code: private func Signing(dataToBeSigned: String) -> String { do { let digest = dataToBeSigned.data(using: .utf8)! let singedData = try Shared.keypair.sign(digest, hash: .sha256) let signature = singedData.base64EncodedString() return signature } catch { return "Cannot sign data" } }

I call it from this code: if(call.method == "Register") { guard let args = call.arguments else { return } if let myArgs = args as? [String: Any], let blaBla1 = myArgs["blaBla1"] as? String, let BlaBla2 = myArgs["BlaBla2"] as? String { let signatureBla1 = self?.Signing(dataToBeSigned: blaBla1) let signatureBla2 = self?.Signing(dataToBeSigned: BlaBla2) let publicKey = self?.getPublicKey() var list = [String]() list.append(publicKey!) list.append(signatureBla1!) list.append(signatureBla2!) result(list) } else { result("iOS could not extract flutter arguments in method: (sendParams)") } self?.Register(result: result)

call.method == "Register" is use to call Register Function from Flutter using MethodChannel.

Can you help if this issue happen because of threads?

hfossli commented 3 years ago

I would check that all the if let's are valid and unwrapped correctly. I don't understand if this compiles because dataToBeSigned expects Data not String

MajidAlNuumani commented 3 years ago

Yes but I convert it to Data in Signing function here dataToBeSigned.data(using: .utf8)!

MajidAlNuumani commented 3 years ago

Hello All,

I got an update in this thread.

I got status error -25300 when call this:

let status = SecItemCopyMatching(query as CFDictionary, &raw)

Any help why this happen in some of iPhone 12 pro and most of iPhone 12 pro max?

MajidAlNuumani commented 3 years ago

Can any one help in this issue?