77 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
0
votes
1
answer
127
views
How to specify desired HKDF output length with `crypto.subtle.deriveKey`
The web crypto API defines two different KDF utilities, namely deriveBits and deriveKey. While the former allows you to specify the desired output length (RFC 5869 calls this parameter L), the latter ...
0
votes
1
answer
40
views
KDBXWeb Saving database works in browser, fails in UnitTest
I'm trying to understand kdbxweb, the database powering keeweb, compatible to Keepass.
I did setup a simple project using vite and vitest that creates, saves and loads a database.
Works like a charm ...
2
votes
0
answers
47
views
How to delete or remove a `crypto.subtle.importKey` key? [duplicate]
The MDN docs on importKey don't seem to provide a way to remove or delete a key once it is no longer needed. Since the function name includes the term "import", which may suggest some degree ...
0
votes
0
answers
95
views
Javascript - SubtleCrypt - SHA1 Hex
I'm researching ways to validate that a password has been pwned or not. Part of the process is to get the SHA-1 hash of the password (I know - not secure - but this is just a first crude attempt at a ...
1
vote
0
answers
51
views
Browser EventLoop prevents window load event from firing when advanced by an async substlecrypto call
Why is it happening and how to fix it? To reproduce comment/uncomment generateKey call and watch the event handler (you might want to put into a module (which is how I use it) or execute is as part ...
1
vote
1
answer
350
views
Generate a pkcs8 key suitable for ECDSA private key import using subtlecrypto
I need to generate a deterministic set ECDSA keys using zero dependencies javascript, for which I produce a pkcs8 key out of raw bytes and then import it as ECDSA private key. Is this logically ...
user avatar
user1514042
1
vote
0
answers
130
views
Cannot generate ECDSA keys from seed due to "Cannot create a key using the specified key usages" error
I'm trying to generate ECDSA keys using seed and salt as inputs. My aim is to get it working with the pure browser javascript (SubtleCrypto) without the use of any external libs, it's an important ...
0
votes
1
answer
150
views
@peculiar/webcrypto - can not access to crypto.subtle
I am using @peculiar/webcrypto 1.5.0.(node v18.18.2)
To test my logic, I need crypto.subtle.
Below is simple test code in my jest.setup.js.
const { Crypto } = require('@peculiar/webcrypto');
global....
0
votes
0
answers
51
views
Do we need CSRF mitigation anymore?
In the past, we needed to mitigate CSRF attacks, in ways described by this OWASP cheatsheet:
Nonce that's stored in session. But this requires storing the nonce in the session data on the server.
The ...
2
votes
0
answers
524
views
Importing a "raw" private key into the subtle crypto js library
I have a private key that is just a simple 32 byte private key that was generated somewhere else entirely outside of javascript. I want to import this private key into javascript using the subtle ...
3
votes
1
answer
924
views
Importing a key for ECDH key derivation in subtle crypto
let randKey = window.crypto.getRandomValues(new Uint8Array(64));
let importedKey = await window.crypto.subtle.importKey("raw", randKey,
{
name: "ECDH",
...
0
votes
1
answer
197
views
SubtleCrypto not verifying but node crypto is
I'm working on doing WebAuthN on the server, and I'm running this in Node:
import nCrypto from "crypto";
const base64UrlToUintArray = (src) => {
const raw = atob(src.replaceAll("-&...
1
vote
1
answer
317
views
Decrypting NTAG424 encrypted data fails sporadically with WebCrypto
This is a follow-up question to a previous one, trying to get a working decryption of NDEF URLs from an NXP NTAG424 tag according to this documentation from NXP (4.4.2.1).
I've put together an initial ...
1
vote
1
answer
495
views
Porting node.js crypto code to SubtleCrypto (WebCrypto) fails with bad decrypt
I'm trying to port working code decoding the values read from an NXP NTAG424 NFC tag in a web-based application. I have a working example that uses crypto in a node.js environment but when I try to ...
0
votes
1
answer
175
views
crypto.subtle.sign() doesn't seem to be doing any signing?
My code:
/*
Fetch the contents of the "message" textbox, and encode it
in a form we can use for the sign operation.
*/
function getMessageEncoding() {
const messageBox = 'hello world!';
...