diff --git a/src/controller/ExampleOperationalCredentialsIssuer.cpp b/src/controller/ExampleOperationalCredentialsIssuer.cpp index 3d2530ddc3f61e..ff94a229009d1f 100644 --- a/src/controller/ExampleOperationalCredentialsIssuer.cpp +++ b/src/controller/ExampleOperationalCredentialsIssuer.cpp @@ -56,9 +56,11 @@ CHIP_ERROR ExampleOperationalCredentialsIssuer::Initialize(PersistentStorageDele PERSISTENT_KEY_OP(mIndex, kOperationalCredentialsIssuerKeypairStorage, key, err = storage.SyncGetKeyValue(key, &serializedKey, keySize)); + serializedKey.SetLength(keySize); if (err != CHIP_NO_ERROR) { + ChipLogProgress(Controller, "Couldn't get %s from storage: %s", kOperationalCredentialsIssuerKeypairStorage, ErrorStr(err)); // Storage doesn't have an existing keypair. Let's create one and add it to the storage. ReturnErrorOnFailure(mIssuer.Initialize()); ReturnErrorOnFailure(mIssuer.Serialize(serializedKey)); @@ -78,9 +80,12 @@ CHIP_ERROR ExampleOperationalCredentialsIssuer::Initialize(PersistentStorageDele PERSISTENT_KEY_OP(mIndex, kOperationalCredentialsIntermediateIssuerKeypairStorage, key, err = storage.SyncGetKeyValue(key, &serializedKey, keySize)); + serializedKey.SetLength(keySize); if (err != CHIP_NO_ERROR) { + ChipLogProgress(Controller, "Couldn't get %s from storage: %s", kOperationalCredentialsIntermediateIssuerKeypairStorage, + ErrorStr(err)); // Storage doesn't have an existing keypair. Let's create one and add it to the storage. ReturnErrorOnFailure(mIntermediateIssuer.Initialize()); ReturnErrorOnFailure(mIntermediateIssuer.Serialize(serializedKey));