Questions tagged [webcrypto-api]

A JavaScript API for performing basic cryptographic operations in web applications, such as hashing, signature generation and verification, and encryption and decryption. Additionally, it describes an API for applications to generate and/or manage the keying material necessary to perform these operations. Uses for this API range from user or service authentication, document or code signing, and the confidentiality and integrity of communications

Web Cryptography API

A w3c standard for managing keys for cryptographic operations.

This specification describes a JavaScript API for performing basic cryptographic operations in web applications, such as hashing, signature generation and verification, and encryption and decryption. Additionally, it describes an API for applications to generate and/or manage the keying material necessary to perform these operations. Uses for this API range from user or service authentication, document or code signing, and the confidentiality and integrity of communications.

Various levels of adoption:

208 questions
17
votes
1 answer

unwrapKey function with AES-KW not working in IE11

On MS Edge following unwrapping code works: window.crypto.subtle.unwrapKey( "raw", wrappedKey, derivedKey, { "name":…
16
votes
1 answer

How to load a PKCS#12 Digital Certificate with Javascript WebCrypto API

I'm trying to sign data using the WebCrypto API, but instead of creating a private/public key and exporting it to pkcs#1 or 8, I would really like to use a user's PKCS#12 to sign data. I've read the W3C spec, but cannot make much of it and can't…
15
votes
3 answers

Accessing signing/encryption in a browser's Keystore using JavaScript - sample code? (WebCryptoAPI)

I have a web server that allows access only using X509 authentication. Works like a charm. Now I want to extend the use of the X509 certificates (which are stored in the user's browser keystore) to Sign data before it is sent to the server (using…
stwissel
  • 19,390
  • 6
  • 44
  • 90
13
votes
2 answers

Digital signature from electronic smartcard in Chrome

For an electronic prescription system, that runs on the browser and that requieres personal signature by the professional, we are using a Java applet to sign the XML request, that then is sended to a WS, using a smartcard. But since version 42,…
lujop
  • 12,544
  • 9
  • 55
  • 90
12
votes
4 answers

Sign PDF with plain JavaScript

With WebCrypto API evolving and being supported by Chrome and Firefox, I would like to use it for digitally signing a PDF document. There is not much of literature around, but I found some examples [1] and a library called PKI.js [2]. In the…
ssc-hrep3
  • 10,806
  • 4
  • 35
  • 77
10
votes
1 answer

WebCrypto string encryption using user-submitted password

Using JavaScript and WebCrypto API (without any external library), what is the best way to encrypt a string using a key derived from a user-submitted password? Here's some code where the key is not derived but simply generated by the generatekey()…
JYF
  • 125
  • 9
10
votes
2 answers

How to save CryptoKey in LocalStorage?

I want to use Web Cryptography API on an already existing project. To encrypt and decrypt something I have to use an CryptoKey, but when I save to CryptoKey into localStorage it only saves the String (CryptoKey) instead of the object. Is it…
8
votes
3 answers

ECDSA signatures between Node.js and WebCrypto appear to be incompatible?

I'm using the following example for signing + verifying in Node.js: https://github.com/nodejs/node-v0.x-archive/issues/6904. The verification succeeds in Node.js but fails in WebCrypto. Similarly, a message signed using WebCrypto fails to verify in…
SiNiquity
  • 103
  • 1
  • 5
8
votes
2 answers

How to load a public key in PEM format for encryption?

Until now I used JSEncrypt which is able to load a public key from a PEM formatted string. And then use it with RSA in order to encrypt a string. For example :