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

Attestation object length #12

Open
andras-the-android opened this issue Feb 15, 2022 · 0 comments
Open

Attestation object length #12

andras-the-android opened this issue Feb 15, 2022 · 0 comments

Comments

@andras-the-android
Copy link

Hi,

I'm experimenting and constructAttestationObject() fails on the assertion because authenticatorData is 164 bytes long instead of 141 and seemingly it's because the encodedPublicKey in constructAttestedCredentialData() is longer than expected. I'm using a Pixel 3 with Android 12 and here is the code snippet I'm useing to call your library:

fun register() {
        val authenticator = Authenticator(context, false, false)
        val options = AuthenticatorMakeCredentialOptions().apply {
            clientDataHash = generateId(32)
            credTypesAndPubKeyAlgs = listOf(Pair("public-key", -7))
            requireUserPresence = true
            rpEntity = RpEntity().apply { name = "Test.Company"; id = "testCompany" }
            userEntity = UserEntity().apply { name = "testUser"; displayName = "Test User"; id = generateId(32) }
        }
        val attestationObject = authenticator.makeCredential(options)
        Log.d(TAG, "attestation object id: ${attestationObject.credentialIdBase64}")
    }

    private fun generateId(length: Int): ByteArray {
        val random = SecureRandom()
        val bytes = ByteArray(length)
        random.nextBytes(bytes)
        return bytes
    }

Thanks in advance!

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