|
|
(2 intermediate revisions by the same user not shown) |
Line 1: |
Line 1: |
− | '''The current specification for the <code>window.Crypto</code> API can now be found in the [http://www.w3.org/2012/webcrypto/WebCryptoAPI/ Web Cryptography API] being developed by the W3C Web Cryptography Working Group.'''
| + | This proposal has been subsumed by the <code>window.crypto</code> API in the [http://www.w3.org/2012/webcrypto/WebCryptoAPI/ Web Cryptography API] being developed by the W3C Web Cryptography Working Group. |
− | | |
− | ==Overview==
| |
− | | |
− | This document describes a proposal for the window.crypto API.
| |
− | | |
− | ==Definitions==
| |
− | | |
− | ===Cryptographically Random Values===
| |
− | | |
− | A <b id=concept-cryptographically-random-values title=concept-cryptographically-random-values>cryptographically random value</b> is a value generated from a cryptographically strong pseudo-random number generator seeded with truly random values. In practice, implementations should generate cryptographically random values using well-established cryptographic pseudo-random number generators, such as RC4, seeded with high-quality entropy, such as from an operating-system entropy source (e.g., ''/dev/urandom''). This document provides no lower-bound on the information theoretic entropy present in cryptographically random values, but implementations should make a best effort to provide as much entropy as practicable.
| |
− | | |
− | ==Interface <code title>Crypto</code>==
| |
− | | |
− | <pre>interface Crypto {
| |
− | ArrayBufferView getRandomValues(in ArrayBufferView array);
| |
− | };
| |
− | | |
− | partial interface Window {
| |
− | readonly attribute Crypto crypto;
| |
− | };</pre>
| |
− | | |
− | The <b id=dom-Crypto-getRandomValues title=dom-Crypto-getRandomValues><code>getRandomValues(<var>array</var>)</code></b> must run the following steps:
| |
− | # <var>array</var> is an [http://www.khronos.org/registry/typedarray/specs/latest/#6 ArrayBufferView]. If <var>array</var> is not of an integer type (i.e., Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, or Uint32Array), [http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-throw throw] a [http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#typemismatcherror TypeMismatchError] and abort these steps.
| |
− | # If <var>array</var>'s length is greater than 65536, [http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#concept-throw throw] a [http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#quotaexceedederror QuotaExceededError] and abort these steps.
| |
− | # Overwrite all elements of <var>array</var> with [[#concept-cryptographically-random-values|cryptographically random values]] of the appropriate type.
| |
− | # Return <var>array</var>.
| |
− | | |
− | [[Category:Proposals]]
| |