Skip to content

[VSC-1539] Fix scenario for partial encryption #1373

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

Merged
merged 3 commits into from
Jul 2, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 28 additions & 6 deletions src/flash/flashTask.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,28 @@ export class FlashTask {
this.model.flashSections &&
this.model.flashSections.length === encryptedFlashSections.length
) {
// If all files need encryption, then use --encrypt flag
flasherArgs.push("--encrypt");
// Add all files
for (const flashFile of this.model.flashSections) {
let binPath = replacePathSep
? flashFile.binFilePath.replace(/\//g, "\\")
: flashFile.binFilePath;
flasherArgs.push(flashFile.address, binPath);
}
} else {
// If only some files need encryption, handle them separately
// First add all unencrypted files normally
const unencryptedSections = this.model.flashSections.filter(
(section) => !section.encrypted
);
for (const flashFile of unencryptedSections) {
let binPath = replacePathSep
? flashFile.binFilePath.replace(/\//g, "\\")
: flashFile.binFilePath;
flasherArgs.push(flashFile.address, binPath);
}
// Then add encrypted files after the --encrypt-files flag
flasherArgs.push("--encrypt-files");
for (const flashFile of encryptedFlashSections) {
let binPath = replacePathSep
Expand All @@ -220,12 +240,14 @@ export class FlashTask {
flasherArgs.push(flashFile.address, binPath);
}
}
}
for (const flashFile of this.model.flashSections) {
let binPath = replacePathSep
? flashFile.binFilePath.replace(/\//g, "\\")
: flashFile.binFilePath;
flasherArgs.push(flashFile.address, binPath);
} else {
// No encryption needed, just add all files.
for (const flashFile of this.model.flashSections) {
let binPath = replacePathSep
? flashFile.binFilePath.replace(/\//g, "\\")
: flashFile.binFilePath;
flasherArgs.push(flashFile.address, binPath);
}
}

return flasherArgs;
Expand Down