Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Key and certificates management and storage #19

Open
whyoleg opened this issue Feb 21, 2024 · 6 comments
Open

Key and certificates management and storage #19

whyoleg opened this issue Feb 21, 2024 · 6 comments
Milestone

Comments

@whyoleg
Copy link
Owner

whyoleg commented Feb 21, 2024

Introduce an API for storing keys in JDK KeyStore, Apple KeyChain, SecureEnclave and other places.

@whyoleg whyoleg added this to the 0.5.0 milestone Mar 28, 2024
@eygraber
Copy link

Any high level thoughts on how to do this until the library supports it?

@whyoleg
Copy link
Owner Author

whyoleg commented Aug 28, 2024

Hey @eygraber, unfortunately, not at this point. I haven't really investigated this a lot, as there is a lot of questions and differences in behaviour on different OS's.

@eygraber
Copy link

I'm investigating this, and got a good implementation on JVM.

Android is an issue because it doesn't allow you to export any Key that was added to the AndroidKeyStore. I tried creating my own KeyStore, and encrypt the password for it with a SecretKey from the AndroidKeyStore but that doesn't work since Android doesn't support JKS keystores and PKCS12 only allows PrivateKey not SecretKey.

Is there any way to add some interop there so it is easy to create Cipher from a JSecretKey directly? Otherwise I don't see a way to make this work with the AndroidKeyStore.

@eygraber
Copy link

And right after I sent that I found that on Android the BKS KeyStore should work 😅

@whyoleg
Copy link
Owner Author

whyoleg commented Aug 29, 2024

Yeah, providing some interop functions for JDK APIs would be nice, though it's not a priority at the moment. Feel free to create an issue for that, and if you do want to contribute I would be glad to discuss design. Until now, you can take a look on Cipher implementations in JDK - they are really rather simple.

@eygraber
Copy link

eygraber commented Sep 5, 2024

I have a working version abstracting this across Android, iOS, JVM, and web here. The web implementation unfortunately just stores the key in indexedDb, so it should only be used in scenarios where there is implicit trust in the environment or there is reliance on external factors to maintain security (e.g. the browser won't be accessible unless the user has logged into their OS account).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants