How to use SubtleCrypto in chrome (window.crypto.subtle is undefined)

Related searches

This is really embarassing

on virtually any site on the internet,

window.crypto.subtle

returns

SubtleCrypto {}
  __proto__: SubtleCrypto

in the chrome console (v61 (Official Build) (64-bit))

except for

my webpage, and blank.org

where

window.crypto.subtle

returns

undefined

according to https://developer.mozilla.org/en-US/docs/Web/API/Crypto/subtle it's a read-only property that should always return a SubtleCrypto object.

what could I have done, or what has blank.org done that it could possibly not?

ps: in firefox it seems to work as intended on both my site and blank.org

According to the spec (via Github issues) a la this Google page for WebCrypto:

crypto.subtle is supposed to be undefined in insecure contexts

Crypto.subtle - Web APIs - MDN Web Docs, A SubtleCrypto object you can use to interact with the Web Crypto API's low-level cryptography features. Specifications. Specification, Status� The Crypto.subtle read-only property returns a SubtleCrypto which can then be used to perform low-level cryptographic operations. Syntax var crypto = crypto.subtle; Value. A SubtleCrypto object you can use to interact with the Web Crypto API's low-level cryptography features. Specifications

check your URL's

if it is https://localhost:PORT or 0.0.0.0:port or 127.0.0.0:port

change it to proper hostname URL something like http://localhost:PORT

worked for me! Thanks @Zmart

window.crypto.subtle missing from bundled chrome version � Issue , How to use SubtleCrypto in chrome (window.crypto.subtle is undefined) - javascript. Using SubtleCrypto. We can split the functions implemented by this API into two groups: cryptography functions and key management functions. Cryptography functions. These are the functions you can use to implement security features such as privacy and authentication in a system. The SubtleCrypto API provides the following cryptography functions:

It would appear you have to use sites with https://...... and not vanilla http://....

From the spec - easy to miss (and linked by Zmart, above):

Access to the WebCrypto API is restricted to secure origins (which is to say https:// pages).

crypto.subtle is undefined on React Native � Issue #7 � kevlened , window.crypto.subtle crypto is missing from the headless chromium installed Added a --secure-origin option andywer/puppet-run#10. Use the generateKey() method of the SubtleCrypto interface to generate a new key (for symmetric algorithms) or key pair (for public-key algorithms).. Syntax const result = crypto.subtle.generateKey(algorithm, extractable, keyUsages);

WebCrypto, crypto.subtle is undefined here (and everywhere else even later on) on When using Chrome debugging, all JavaScript code runs within Just running msrCrypto in a browser shouldn't be enough for it to use Web Workers. I found out that the Problem only ocures while using chrome. Through the comment of Zmart on another question, I found out that crypto.subtle is supposed to return undefined in "insecure" context. How to use SubtleCrypto in chrome (window.crypto.subtle is undefined) I used the script Alex commented to solve my issue.

Tools/Scripts/run-webkit-tests --debug crypto; 8.5 Getting "XOpenDisplay failed" The WebCrypto API was enabled by default starting in Chrome 37 (August 26, 2014) Note: In the spec, crypto.subtle is supposed to be undefined in insecure � How to use SubtleCrypto in chrome (window.crypto.subtle is undefined) Awarded yesterday

Comments