Questions tagged [subtlecrypto]

63 questions
0
votes
0 answers

Converting a public key in string format to cryptokey in SubtleCrypto

I'm trying to use crypto module in js and subtleCrypto to encode a string with a public key. I want to give the public key as a string but my code in subtle crypto throws error that "parameter 2 is not of type 'CryptoKey'. here's my code: const…
m0j1
  • 4,067
  • 8
  • 31
  • 54
0
votes
1 answer

Signing a string with an RSA key in Python - how can I translate this JavaScript code that uses SubtleCrypto to Python?

I am trying to sign a string with an RSA key in Python. I have working JavaScript code that does it, but now I need to replicate it in Python using Python-RSA. In particular, these are the two JavaScript calls that I need to deal with: const key =…
PlinyTheElder
  • 1,454
  • 1
  • 10
  • 15
0
votes
1 answer

Can SubtleCrypto.verify() use a digest instead of the original message?

https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/verify Algorithms like ES224, ES256, ES384, and ES512 are designed for use with digests, however, Javascript does not appear to support this design and instead requires the full original…
Zamicol
  • 4,626
  • 1
  • 37
  • 42
0
votes
0 answers

How to verify an EC signature created by OpenSSL with the Subtle Crypto API?

I have a small JSON file which contains an EC signature generated by SubtleCrypto.sign() ECDSA algorithm and SHA512 digest. Now I manually generate the signature, but I would like to automate it. I have a restriction to use the nginx:alpine base…
Hodossy Szabolcs
  • 1,598
  • 3
  • 18
  • 34
0
votes
0 answers

How to use a key generated with the .net RSACryptoServiceProvider class with the browser SubtleCrypto module?

I have written the following C# code: static void createSHA256KeyFile(string publicKeyPath, string privateKeyPath) { using (RSACryptoServiceProvider rsa = new RSACryptoServiceProvider(1024)) { try …
Vivian River
  • 31,198
  • 62
  • 198
  • 313
0
votes
0 answers

How can I pipe streams in the browser to decrypt an encrypted file?

I am retrieving a file from IPFS and storing it as an array buffer in the browser. I want to decrypt it in a stream and save it locally. During storage, I encrypted it like this: const iv = crypto.randomBytes(16); const cipher =…
Boris K
  • 3,442
  • 9
  • 48
  • 87
0
votes
1 answer

Why do Google Apps Script and Crypto.subtle generate different RSA signatures?

I can't figure out why these two pieces of code generate different signatures when using the same message and key as inputs. Does anyone know what I'm doing wrong? I've tried putting \0 or \n at the end of either message. I've tried using ASCII…
0
votes
1 answer

How do you implement digest authentication with SHA-256 when modern web browsers disable SubtleCrypto when you're not in a secure context (https)?

I've got a very basic web server running on an ESP8266 microcontroller, so system resources are very limited, but I figure it can probably deal with SHA-256 (I'll guess we'll see, but that's a separate issue). I've got the barebones digest…
Dan Forever
  • 381
  • 2
  • 12
0
votes
0 answers

Is it possible to generate PKCS#10 with Javascript SubtleCrypto API?

I was able to create PKCS#8 Private & Public RSA keys with the SubtleCrypto API. Is it possible to create the very useful PKCS#10 Certificate Signing Request with it as well?
suchislife
  • 4,251
  • 10
  • 47
  • 78
0
votes
0 answers

Why it's not possible to export the key, when you generate a key for encryption and decryption in subtleCrypto?

Here: const fs = require("fs").promises; const { subtle } = require("crypto"); const getPem = require("rsa-pem-from-mod-exp"); async function createPub() { const keyPair = await subtle.generateKey({ name: "RSASSA-PKCS1-v1_5", …
milanHrabos
  • 2,010
  • 3
  • 11
  • 45
0
votes
1 answer

Wrong result with HMAC verification using SubtleCrypto in JavaScript

I am trying to verify a HMAC signature using the SubtleCrypto API. The whole thing is supposed to run in Cloudflare Workers and I am testing it locally using their wrangler tool. This is my code so far, but it generates the wrong signature. const…
Johannes Gontrum
  • 1,130
  • 1
  • 10
  • 12
0
votes
1 answer

NodeJS SubtleCrypto - Multiple keyUsage for RSA Keys

I'm so sorry for the ambiguous title of this question, i'm not really sure how to phrase this. I've generated a Public and Private key using SubtleCrypto in NodeJS like so: const { publicKey, privateKey } = await subtle.generateKey({ …
SunAwtCanvas
  • 1,261
  • 1
  • 13
  • 38
0
votes
0 answers

How to decrypt AES SubtleCrypto [window.subtle.crypto] at CryptoJS

I'm attempting to migrate from Browser-only window.subtle.crypto to CryptoJS so it is universally available across all platforms using Expo. Essentially: window.subtle.encrypt({name: AES-GCM}) -> CryptoJS.AES.decrypt For the existing data encrypted,…
0
votes
1 answer

WebCrypto Generate ECDSA signature in base64

I wanna generate an ECDSA signature and convert it to base64. I can easily accomplish this with Nodejs: const sign = crypto.createSign('SHA256') sign.update('part1') sign.update('part2') const signature = sign.sign(privateKey,…
0
votes
1 answer

SubtleCrypto Import key pair Unhandled error Error: Too big integer

I'm working on a simple proof of concept to export and import private and public keys through node.js and browser communication using SubtleCrypto. I've installed the @peculiar/webcrypto package to keep things consistent between the front and…