"Error: Unknown message digest" when using crypto.subtle.verify({'name':'ECDSA', 'hash':'SHA-256'}, ...)
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 35/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- javascript, nodejs, wasm
- Ambito
- build-system, cryptography
Direzione di ricerca
Inizia in webextension/content/tls.js, intorno alla chiamata a crypto.subtle.verify alla riga 634, e confronta il percorso di bundle.js in bundle con il comportamento di pgsg-node.js non sottoposto a bundle. Riproduci il problema con node bundle.js e qjs bundle.js, quindi traccia il percorso con cui la verifica ECDSA SHA-256 raggiunge crypto-browserify. Il lavoro è completato quando la verifica in bundle non segnala più “Unknown message digest”, preservando al contempo l’importazione riuscita della chiave.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
I'm trying to bundle the PageSigner pgsg-node.js (written in NodeJS) using browserify, such that I can run it via QuickJS and eventually compile it to WASM. (Not for a browser application however - I need to run it on a WASM VM).
After some necessary edits to the code of pgsg-node.js, I managed to successfully execute both node bundle.js and the QuickJS analogue qjs bundle.js and log the final output to the console. However, that only works if I remove this crucial line:
var result = await crypto.subtle.verify({'name':'ECDSA', 'hash':'SHA-256'}, notary_pk_CryptoKey, ba2ab(sig_p1363), ba2ab(signed_data_ba))
and replace it with var result = true. Otherwise I get the following error after executing node bundle.js:
Error: Unknown message digest
at new Verify (/home/metzgerj/CoaseContract/pagesigner/webextension/content/pgsg-node/bundle.js:13849:20)
at Object.createVerify (/home/metzgerj/CoaseContract/pagesigner/webextension/content/pgsg-node/bundle.js:13882:10)
at Function.verify (/home/metzgerj/CoaseContract/pagesigner/webextension/content/pgsg-node/bundle.js:33318:51)
at EcdsaProvider.onVerify (/home/metzgerj/CoaseContract/pagesigner/webextension/content/pgsg-node/bundle.js:33496:25)
at EcdsaProvider.verify (/home/metzgerj/CoaseContract/pagesigner/webextension/content/pgsg-node/bundle.js:82175:30)
at SubtleCrypto.verify (/home/metzgerj/CoaseContract/pagesigner/webextension/content/pgsg-node/bundle.js:82832:39)
at verifyNotarySig (/home/metzgerj/CoaseContract/pagesigner/webextension/content/pgsg-node/bundle.js:2724:39)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async verifyPgsgV4 (/home/metzgerj/CoaseContract/pagesigner/webextension/content/pgsg-node/bundle.js:723:10)
at async Object.verifyPgsg (/home/metzgerj/CoaseContract/pagesigner/webextension/content/pgsg-node/bundle.js:661:12) Error
(node:7830) UnhandledPromiseRejectionWarning: Error: Unknown message digest
at new Verify (/home/metzgerj/CoaseContract/pagesigner/webextension/content/pgsg-node/bundle.js:13849:20)
at Object.createVerify (/home/metzgerj/CoaseContract/pagesigner/webextension/content/pgsg-node/bundle.js:13882:10)
at Function.verify (/home/metzgerj/CoaseContract/pagesigner/webextension/content/pgsg-node/bundle.js:33318:51)
at EcdsaProvider.onVerify (/home/metzgerj/CoaseContract/pagesigner/webextension/content/pgsg-node/bundle.js:33496:25)
at EcdsaProvider.verify (/home/metzgerj/CoaseContract/pagesigner/webextension/content/pgsg-node/bundle.js:82175:30)
at SubtleCrypto.verify (/home/metzgerj/CoaseContract/pagesigner/webextension/content/pgsg-node/bundle.js:82832:39)
at verifyNotarySig (/home/metzgerj/CoaseContract/pagesigner/webextension/content/pgsg-node/bundle.js:2724:39)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async verifyPgsgV4 (/home/metzgerj/CoaseContract/pagesigner/webextension/content/pgsg-node/bundle.js:723:10)
at async Object.verifyPgsg (/home/metzgerj/CoaseContract/pagesigner/webextension/content/pgsg-node/bundle.js:661:12)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:7830) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:7830) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
What's weird is that at least some of the crypto.subtle functionality works, the line right before
var notary_pk_CryptoKey = await crypto.subtle.importKey(
"raw", ba2ab(notaryPubkey_ba), {name: 'ECDSA', namedCurve:'P-256'}, true, ["verify"]);
works flawlessly. Also, executing my modified unbundled file node pgsg-node.js does not produce this error.
- Lingua principale
- JavaScript
- Stelle
- 681
- Fork
- 209
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di browserify/crypto-browserify
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 35/100
browserify/crypto-browserify#255 · 1 reazione ·
-
Fixing yml syntax errorAperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 35/100
browserify/crypto-browserify#250 · 1 commento ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 30/100
browserify/crypto-browserify#240 ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
browserify/crypto-browserify#238 · 3 commenti ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
browserify/crypto-browserify#232 · 6 commenti ·
Tutte le issue di browserify/crypto-browserify
Issue simili
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
glossyio/traffic-monitor#255 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
juice-shop/juice-shop#3706 ·
I maintainer di solito rispondono entro 1 giorno
-
Main workflow runs twice for newly created refsForse già presa @rustyconover l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
duckdb/duckdb-wasm#2293 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
521xueweihan/HelloGitHub#4115 ·
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
outline/outline#14348 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno