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

[BUG] How can i sign noc bymyself to finish commissioning on Android #29616

Closed
freemanspace opened this issue Oct 6, 2023 · 3 comments
Closed
Labels
android bug Something isn't working needs triage

Comments

@freemanspace
Copy link

Reproduction steps

i use chiptool-Android-master project to do this
i want sign noc by myself ,so i set NOCChainIssuer to do this
but don't work,
please help!

code as below=======================================

deviceController.setNOCChainIssuer { csrInfo, attestationInfo ->
var controllerParams = ControllerParams.newBuilder()
.setControllerVendorId(deviceInfo.vendorId)
.setRootCertificate(byteArrayOf(rootCertificate))
.setIntermediateCertificate(byteArrayOf(intermediateCertificate))
.setOperationalCertificate(byteArrayOf(operationalCertificate))
.setIpk(byteArrayOf(opk))
.build()
Log.d(TAG,"finish init controllerParams")
Log.d(TAG,"start onNOCChainGeneration")
deviceController.onNOCChainGeneration(controllerParams) <----it will lock no log to print
Log.d(TAG,"end onNOCChainGeneration")
}

log as below=============================================
2023-10-06 15:04:48.563 7989-8012 CTL com.google.chip.chiptool D Received certificate signing request from the device
2023-10-06 15:04:48.564 7989-8012 CTL com.google.chip.chiptool D Successfully finished commissioning step 'SendOpCertSigningRequest'
2023-10-06 15:04:48.564 7989-8012 CTL com.google.chip.chiptool D Commissioning stage next step: 'SendOpCertSigningRequest' -> 'ValidateCSR'
2023-10-06 15:04:48.564 7989-8012 CTL com.google.chip.chiptool D Performing next commissioning step 'ValidateCSR'
2023-10-06 15:04:48.618 7989-8012 CTL com.google.chip.chiptool D Successfully finished commissioning step 'ValidateCSR'
2023-10-06 15:04:48.618 7989-8012 CTL com.google.chip.chiptool D Commissioning stage next step: 'ValidateCSR' -> 'GenerateNOCChain'
2023-10-06 15:04:48.618 7989-8012 CTL com.google.chip.chiptool D Performing next commissioning step 'GenerateNOCChain'
2023-10-06 15:04:48.618 7989-8012 CTL com.google.chip.chiptool D Getting certificate chain for the device from the issuer
2023-10-06 15:04:48.618 7989-8012 CTL com.google.chip.chiptool D Parsing Certificate Signing Request
2023-10-06 15:04:48.642 7989-8012 TOO com.google.chip.chiptool D VerifyCertificateSigningRequest
2023-10-06 15:04:48.643 7989-8012 DeviceProv...ngFragment com.google.chip.chiptool D finish init controllerParams
2023-10-06 15:04:48.643 7989-8012 DeviceProv...ngFragment com.google.chip.chiptool D start onNOCChainGeneration

Bug prevalence

every time

GitHub hash of the SDK that was being used

#29574

Platform

android

Platform Version(s)

No response

Anything else?

No response

@bzbarsky-apple
Copy link
Contributor

it will lock no log to print

Does it help if you make this call async? Because my guess is that the Android bits are calling into your callback with the Matter stack lock held (which if true seems like a very strange thing to do), then onNOCChainGeneration tries to take the lock and deadlocks.

@yunhanw-google

@bzbarsky-apple bzbarsky-apple changed the title [BUG] How can i sign noc bymyself to finish commissioning [BUG] How can i sign noc bymyself to finish commissioning on Android Oct 6, 2023
@freemanspace
Copy link
Author

deviceController.onNOCChainGeneration(controllerParams)
must be run on mainthread
change to main Thread will work

@github-project-automation github-project-automation bot moved this from Todo to Done in [Platform] Android Dec 5, 2023
@freemanspace
Copy link
Author

deviceController.onNOCChainGeneration(controllerParams)
must be run on mainthread
change to main Thread will work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
android bug Something isn't working needs triage
Projects
Archived in project
Development

No branches or pull requests

2 participants