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

android.security.KeyStoreException #24

Open
hsseo opened this issue Mar 8, 2024 · 3 comments
Open

android.security.KeyStoreException #24

hsseo opened this issue Mar 8, 2024 · 3 comments

Comments

@hsseo
Copy link

hsseo commented Mar 8, 2024

I am using KeyAttestation well.

I have one question.

I have a problem when I proceed as follows on a specific device.


val builder = KeyGenParameterSpec.Builder(alias, purposes)
.setAlgorithmParameterSpec(ECGenParameterSpec("secp256r1"))
.setDigests(KeyProperties.DIGEST_SHA256)
.setCertificateNotBefore(now)
.setAttestationChallenge(now.toString().toByteArray())

val keyPairGenerator = KeyPairGenerator.getInstance(KeyProperties.KEY_ALGORITHM_EC, "AndroidKeyStore")
keyPairGenerator.initialize(builder.build())
keyPairGenerator.generateKeyPair()

KeyStore Exception occurs in keyPairGenerator.generateKeyPair().
The exception contents are as follows.


android.security.KeyStoreException: -74 (internal Keystore code: -74 message: In generate_key.

Caused by:
0: While generating Key without explicit attestation key.
1: Error::Km(ErrorCode(-74))) (public error code: 10 internal Keystore code: -74)

KeyStoreException occurs due to the .setAttestationChallenge(now.toString().toByteArray()) part.
Can I get some help in this regard?

@shatyuka
Copy link

shatyuka commented Mar 8, 2024

-74: ATTESTATION_KEYS_NOT_PROVISIONED

@hsseo
Copy link
Author

hsseo commented Mar 8, 2024

Thanks to reply
Why does the ATTESTATION_KEYS_NOT_PROVISIONED error occur?
It works fine on other devices, but not on this device.

@hangedfish
Copy link

Same Problem in device xiaomi 14 with Xiaomi HyperOS (Android 14) System

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

3 participants