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

Support for unexportable private keys #112

Open
fgrape opened this issue Mar 11, 2022 · 0 comments
Open

Support for unexportable private keys #112

fgrape opened this issue Mar 11, 2022 · 0 comments

Comments

@fgrape
Copy link

fgrape commented Mar 11, 2022

ArrayList<ASN1.TagValue> pkl = ASN1.DecodePKCS8Structure(privKey.getEncoded());

This line of code makes it impossible to use this with any PrivateKey implementation from providers that do not allow you to access the key material, e.g. the AndroidKeyStore, Azure key vault, or AWS KMS providers.

However, since you are using the ASN.1 sequence from PrivateKey.getEncoded() to get information about the private key such as the algorithm etc that would have to be done in some other way since the method returns null for such private keys. PrivateKey.getFormat() also returns null for such keys as it refers to the format of the encoded key. PrivateKey.getAlgorithm() (link) will return one of the standard algorithm names as defined here.

I think this would be a nice feature to have. But I don't understand this code base enough and the features it needs to have if it is feasible to support this for the generic case, right now I have a workaround where I have implemented signing using unexportable private keys myself.

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

1 participant