Skip to content

Commit

Permalink
Halo: patch sign command for keyNo <= 3 (#241)
Browse files Browse the repository at this point in the history
  • Loading branch information
icedevml authored Aug 11, 2023
1 parent b3f5a98 commit 3d03514
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions halo/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ async function cmdSign(options, args) {
])), "hex");
}

if (args.legacySignCommand || options.method === "webnfc") {
if ((args.legacySignCommand || options.method === "webnfc") && args.keyNo <= 3) {
// the public key will be available through URL parameters
// we only need to sign the digest
if (!pwdHash) {
Expand Down Expand Up @@ -181,7 +181,7 @@ async function cmdSign(options, args) {
let sig = sigBuf.slice(0, sigLen).toString('hex');
let publicKey = null;

if (!args.legacySignCommand && options.method !== "webnfc") {
if ((!args.legacySignCommand && options.method !== "webnfc") || args.keyNo > 3) {
if (sigBuf[sigLen] !== 0x04) {
throw new HaloLogicError("Assertion failed, expected public key first byte to be 0x04.");
}
Expand Down

0 comments on commit 3d03514

Please sign in to comment.