A user account is required in order to edit this wiki, but we've had to disable public user registrations due to spam.

To request an account, ask an autoconfirmed user on IRC (such as one of these permanent autoconfirmed members).

# Difference between revisions of "Crypto"

m |
|||

Line 9: | Line 9: | ||

===Cryptographically Random Values=== | ===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 | + | 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 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>== | ==Interface <code title>Crypto</code>== |

## Revision as of 20:02, 13 August 2012

**The current specification for the window.Crypto API can now be found in the 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 **cryptographically random value** 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 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 `Crypto`

interface Crypto { ArrayBufferView getRandomValues(in ArrayBufferView array); }; partial interface Window { readonly attribute Crypto crypto; };

The ** getRandomValues(** must run the following steps:

`array`)

`array`is an ArrayBufferView. If`array`is not of an integer type (i.e., Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, or Uint32Array), throw a TypeMismatchError and abort these steps.- If
`array`'s length is greater than 65536, throw a QuotaExceededError and abort these steps. - Overwrite all elements of
`array`with cryptographically random values of the appropriate type. - Return
`array`.