Comments (17)
After studying your README again, I could resolve it:
I forgot to replace the token to token: .secureEnclaveIfAvailable
.
Thanks for your support!
from ellipticcurvekeypair.
Hey. Thanks for the kind words. ❤️
Can you try latest code from master? Seems like you are using release. Which simulator are you using?
from ellipticcurvekeypair.
I’m guessing you are using iOS 9 or something? I think your issue has been corrected in master. Sorry about the breaking api changes.
from ellipticcurvekeypair.
@hfossli
thank you very much for the fast response.
You were right, I was using release. I just updated to master and did the corresponding api-changes.
Testing on device (secure enclave) is still successful. Testing on simulator (keychain) still responds with an error, but now it is another one:
underlying(message: "Could not generate keypair.", error: Error Domain=NSOSStatusErrorDomain Code=-26276 "Could not generate keypair." UserInfo={NSLocalizedRecoverySuggestion=See https://www.osstatus.com/search/results?platform=all&framework=all&search=-26276, NSLocalizedDescription=Could not generate keypair.})
OSStatus.com sais: An internal error occured in the Security framework.
I tried different iPhone simulators featuring iOS 11.2.
from ellipticcurvekeypair.
Are you on main thread/queue? Try to be on another queue. Can you paste the code?
from ellipticcurvekeypair.
Also, make sure you delete and recreate the keys.
from ellipticcurvekeypair.
And try with these access flags
let publicAccessControl = EllipticCurveKeyPair.AccessControl(protection: kSecAttrAccessibleAlwaysThisDeviceOnly, flags: [])
let privateAccessControl = EllipticCurveKeyPair.AccessControl(protection: kSecAttrAccessibleAfterFirstUnlockThisDeviceOnly, flags: {
return EllipticCurveKeyPair.Device.hasSecureEnclave ? [.userPresence, .privateKeyUsage] : [.userPresence]
}())
from ellipticcurvekeypair.
The code I am using is:
struct KeyPair {
static let manager: EllipticCurveKeyPair.Manager = {
let publicAccessControl = EllipticCurveKeyPair.AccessControl(protection: kSecAttrAccessibleAlwaysThisDeviceOnly, flags: [])
let privateAccessControl = EllipticCurveKeyPair.AccessControl(protection: kSecAttrAccessibleAfterFirstUnlockThisDeviceOnly, flags: {
return EllipticCurveKeyPair.Device.hasSecureEnclave ? [.userPresence, .privateKeyUsage] : [.userPresence]
}())
let config = EllipticCurveKeyPair.Config(
publicLabel: "n.sign.public",
privateLabel: "n.sign.private",
operationPrompt: "n Ident",
publicKeyAccessControl: publicAccessControl,
privateKeyAccessControl: privateAccessControl,
token: .secureEnclave)
return EllipticCurveKeyPair.Manager(config: config)
}()
}
No difference for me on different queues :(
How do I remove keys?
from ellipticcurvekeypair.
do {
try KeyPair.manager.deleteKeypair()
} catch {
...
}
from ellipticcurvekeypair.
Or just delete the app before you install
from ellipticcurvekeypair.
Thank you.
I am now deleting the keypair before creating a new one. On device everything works fine, on simulator still the -26276
-error.
from ellipticcurvekeypair.
I will try to recreate the bug on my end. I need xcode version, mac version, simulator version etc.
from ellipticcurvekeypair.
That would be great!
macOS High Sierra 10.13.3
XCode Version 9.2
iPhone simulators iOS 11.2
Deployment Target 10.0
do you need anything else?
from ellipticcurvekeypair.
Xcode build version and swift version would also be useful.
from ellipticcurvekeypair.
XCode Version 9.2 (9C40b)
Swift 3.2
from ellipticcurvekeypair.
Ah! That makes sense! Maybe a better error message could be nice in that case. Keeping it open until I fix that. Thanks!
from ellipticcurvekeypair.
why can I generate key pair from login screen?
from ellipticcurvekeypair.
Related Issues (20)
- Can I export the EC Private key ? HOT 2
- no prompts shown for face id auth on simulator HOT 5
- Encrypting messages using CLI Open SSL HOT 5
- deinitialize() and deallocate() causing Compiler Error in SHA256.swift HOT 6
- Demo Project Error HOT 2
- iOS 13 and CryptoKit HOT 1
- Error when signing or decrypting on Simulator (iOS 13) HOT 2
- Publish new version in CocoaPods? HOT 1
- Encryption on MacOS
- Wrong Simulator Detection
- AccessControl for publicKey doesn't restrict to biometryCurrentSet flag HOT 3
- SecItemCopyMatching not works in iphone 12 HOT 6
- Sign twice strings HOT 2
- Is secp256k1 curve supported?
- Create access control with only [.privateKeyUsage] HOT 3
- concern about userPresence HOT 2
- Authenticate only with Biometrics
- Deprecation Warnings and Making export() Method of PublicKey Public HOT 6
- iOS 13+ HOT 3
- Unable to generate key pair
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ellipticcurvekeypair.