Questions tagged [subtlecrypto]

63 questions
1
vote
1 answer

Trouble reproducing SubtleCrypto in Crypto

I have some code utilizing SubtleCrypto that encrypts a key and stores it in a database. For another functionality i have to be able to encrypt it in Node 12. Without SubtleCrypto i have to recreate the functionality in Crypto. I get output of the…
1
vote
1 answer

DOMException during RSA SubtleCrypto decrypt

I'm attempting to use SubtleCrypto to encrypt a string, store the encrypted string, and decrypt that string again, all using a generated RSA-OAEP key pair. The below code produces a DOMException during the decryption phase, however I can't seem to…
IanMckay
  • 116
  • 5
1
vote
1 answer

AES GCM encrypt with web subtlecrypto and decrypt with flutter cryptography

I'm trying to encrypt something in a webextension with SubtleCrypto and decrypt it in flutter with cryptography. I want to use a password to encrypt a message, send it to a app and decrypt it with the same password. For this I use AES GCM with…
Robin Dijkhof
  • 18,665
  • 11
  • 65
  • 116
1
vote
0 answers

How do I export a SubtleCrypto ECDSA private key with PKCS#8 in JavaScript?

I'm trying to export an ECDSA (this probably applies to ECDH as well) private key I've generated with SubtleCrypto in JavaScript. According to MDN (yes, this is for importKey, but this is where you are linked from the page for exportKey), I can use…
Newbyte
  • 2,421
  • 5
  • 22
  • 45
1
vote
0 answers

Cannot store CryptoKey in IndexedDB object store in Firefox

I need to store an ECDH P-384 keypair in an IndexedDB database. This is the code that generates the keypair: async function generateKeys() { // generate client's ECDH asymmetric keypair (privateKey, publicKey) return await…
65536
  • 106
  • 7
1
vote
1 answer

JavaScript SubtleCrypto generating 176-bit AES keys instead of 128-bit?

I'm working on a game that will be communicating with a NodeJS server for various purposes, and I'm currently trying to implement some AES encryption on the request payloads. Everything was working fine while testing between the server and a test…
IceMetalPunk
  • 5,476
  • 3
  • 19
  • 26
1
vote
1 answer

Error on importing a public key 'SubtleCrypto': The provided value cannot be converted to a sequence

I'm trying to import a public key into crypto.subtle and I got a cryptic (pun intended) error: Uncaught (in promise) TypeError: Failed to execute 'importKey' on 'SubtleCrypto': The provided value cannot be converted to a sequence. Here's my…
Zamicol
  • 4,626
  • 1
  • 37
  • 42
0
votes
1 answer

aes256-wrap Error 'ERR_CRYPTO_INVALID_IV' But AES-KW Does Not Require An Initialization Vector?

MDN mentions that: AES-KW does not require an initialization vector (iv) But when I try and encrypt my content encryption key (CEK) using the key encryption key (KEK) like below Node.js Crypto createCipheriv(algorithm, key, iv[, options]) throws…
Ronnie Royston
  • 16,778
  • 6
  • 77
  • 91
0
votes
0 answers

Where is SubtleCrypto's CryptoKey Stored?

I am currently utilizing the WebCrypto API, specifically SubtleCrypto. I store CryptoKey in IndexedDB and call it as needed. As far as I know, IndexedDB is a serialized database. If I can access IndexedDB from the disk, can I retrieve the CryptoKey…
0
votes
1 answer

RSA-OAEP Encrypt: OperationError on File upload but not strings using SubtleCrypto

I am trying to allow the client to upload a file, have the file be encrypted with RSA-OAEP using a public key provided by the server, then have the file be uploaded and completely readable by the server. However, my current code gives me…
OIRNOIR
  • 33
  • 6
0
votes
1 answer

Verifying A JWT With The Crypto Web API

I am trying to verify a JSON Web Token using the Web Crypto API. This is my code so far: async function verify(user: string) { const secret = await crypto.subtle.importKey( "raw", new TextEncoder().encode(process.env.SECRET!), { …
muell
  • 383
  • 1
  • 15
0
votes
0 answers

where to store crypto key?

i am generating key pair using subtlecrypto in web crypto api in javascript, use the code below, but i want to each user only get one key pair during using web app, i mean even after refreshing or sign out the app, the key must persist, how can i…
Faraz
  • 69
  • 1
  • 8
0
votes
1 answer

Getting Subtlecrypto SHA-256 digest different from sha256sum in linux terminal and trying to get file digest

I am getting a different hexdigest for the same string using SHA256 algo in linux terminal and using crypto.subtle. Here is what I am getting: $ echo "foobar" | sha256sum aec070645fe53ee3b3763059376134f058cc337247c978add178b6ccdfb0019f - and using…
Rohit Das
  • 3
  • 3
0
votes
0 answers

Can CryptoKey objects be stolen during an XSS attack?

Crypto keys stored in IndexedDB with {extractable: false} cannot be exported. In other words: the key itself cannot be retrieved but the CryptoKey object that owns the key has APIs that can be used to encrypt, decrypt, verify, or sign data based on…
raneshu
  • 363
  • 2
  • 16
  • 46
0
votes
1 answer

window.crypto.subtle.importkey and sign issue

In typescript I have the following code to sign a message with the ecdsa method and the SHA-512 algorithm. const pem = "-----BEGIN PRIVATE…
Maniac_1979
  • 879
  • 3
  • 10
  • 26