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

PAA certificate and QR code reading in factory mode (CON-1385) #1126

Open
MaplestoryAlen opened this issue Oct 22, 2024 · 2 comments
Open

PAA certificate and QR code reading in factory mode (CON-1385) #1126

MaplestoryAlen opened this issue Oct 22, 2024 · 2 comments

Comments

@MaplestoryAlen
Copy link

Preparing to start certification, I encountered a few issues:

  1. The laboratory requires a PAA certificate, and the testing certificate in the SDK cannot be used for identity verification. Can the development certificate (connected homeip \ credentials \ development) in the SDK be used for laboratory certification?
    2.If the factory mode is used to write chip information, can the QR code be read?
    For example:
    PrintOnboardingCodes(chip::RendezvousInformationFlag::kNone);
    char payloadBuffer[chip::QRCodeBasicSetupPayloadGenerator::kMaxQRCodeBase38RepresentationLength + 1];
    chip::MutableCharSpan qrCode(payloadBuffer);
    GetQRCode(qrCode,chip::RendezvousInformationFlag::kOnNetwork);
    strcpy(device_info.qrcode,payloadBuffer);
    USER_LOGI(TAG,"QRCode: %s",device_info.qrcode);
@github-actions github-actions bot changed the title PAA certificate and QR code reading in factory mode PAA certificate and QR code reading in factory mode (CON-1385) Oct 22, 2024
@shubhamdp
Copy link
Contributor

  1. Well, not sure if one from credentials/development/attestation can be used but you can generate one using chip-cert utility.
    If you have run esp-matter/install.sh, then utility is present at connectedhomeip/connectedhomeip/out/host/chip-cert and this PATH is appended to $PATH so, after sourcing esp-matter/export.sh its available for use.
    Details about generating certs can be found in the esp-matter's certification guide.

  2. As per section 5.1.7. Generation of the Passcode in Core Matter Specification, it is recommended that you do not store the passcode on the device.
    If stored, its location must be physically isolated from where the verifier is stored.
    You will either have to keep a map of QRCode<-->device, OR you can take a look at light_switch which implements custom provider which generates the random passcode and then you can use the PrintOnboardingCodes() to print the QRCode.

@MaplestoryAlen
Copy link
Author

2. PrintOnboardingCodes()

I get discriminator, passcode, vid, pid, and then call the interface to print the QR code. An error is reported

CSV:
image

code:

void PrintOnboardingCodesWithFactoryDataProvider(ESP32FactoryDataProvider & provider)
{
SetupPayload payload;

uint16_t discriminatorValue = 2508;
payload.discriminator.SetLongValue(discriminatorValue); 
uint32_t setupPasscode = 10230953; 
payload.setUpPINCode = setupPasscode; 
payload.vendorID = 0x1575; 
payload.productID = 0x2024; 


PrintOnboardingCodes(payload);


QRCodeSetupPayloadGenerator generator(payload);
std::string qrCode;
CHIP_ERROR err = generator.payloadBase38Representation(qrCode);

if (err == CHIP_NO_ERROR) {
    USER_LOGW(TAG,"SetupQRCode: \n%s\n", qrCode.c_str());
} else {
    USER_LOGW(TAG,"Failed to generate QR code: %s\n", ErrorStr(err));
}

std::string manualPairingCode;
err = ManualSetupPayloadGenerator(payload).payloadDecimalStringRepresentation(manualPairingCode);

if (err == CHIP_NO_ERROR) {
    USER_LOGW(TAG,"ManualPairingCode: %s\n", manualPairingCode.c_str());
} else {
    USER_LOGW(TAG,"Failed to generate manual pairing code: %s\n", ErrorStr(err));
}

}

log:
image

The manualPairingCode printed correctly, but the QR code reported an error. I don't know where the problem lies

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