Bug 25382 - Return InvalidAccessError in method proedures if name of algorithm does not match name of the algorithm of the provided key
--- a/spec/Overview-WebCryptoAPI.xml Tue Sep 23 10:05:34 2014 -0700
+++ b/spec/Overview-WebCryptoAPI.xml Tue Sep 23 10:43:42 2014 -0700
@@ -1374,6 +1374,16 @@
</li>
<li>
<p>
+ If the <a href="#dfn-Algorithm-name">name</a> member of
+ <var>normalizedAlgorithm</var> is not equal to the
+ <a href="#dfn-KeyAlgorithm-name">name</a> attribute of the
+ [[<a href="#dfn-CryptoKey-slot-algorithm">algorithm</a>]] internal slot of
+ <var>key</var> then <a href="#concept-return-an-error">return an error</a> named <a
+ href="#dfn-InvalidAccessError"><code>InvalidAccessError</code></a>.
+ </p>
+ </li>
+ <li>
+ <p>
If the [[<a href="#dfn-CryptoKey-slot-usages">usages</a>]] internal slot of
<var>key</var> does not contain an entry that is <code>"encrypt"</code>, then <a
href="#concept-return-an-error">return an error</a> named <a
@@ -1457,6 +1467,16 @@
</li>
<li>
<p>
+ If the <a href="#dfn-Algorithm-name">name</a> member of
+ <var>normalizedAlgorithm</var> is not equal to the
+ <a href="#dfn-KeyAlgorithm-name">name</a> attribute of the
+ [[<a href="#dfn-CryptoKey-slot-algorithm">algorithm</a>]] internal slot of
+ <var>key</var> then <a href="#concept-return-an-error">return an error</a> named <a
+ href="#dfn-InvalidAccessError"><code>InvalidAccessError</code></a>.
+ </p>
+ </li>
+ <li>
+ <p>
If the [[<a href="#dfn-CryptoKey-slot-usages">usages</a>]] internal slot of
<var>key</var> does not contain an entry that is <code>"decrypt"</code>, then <a
href="#concept-return-an-error">return an error</a> named <a
@@ -1540,6 +1560,16 @@
</li>
<li>
<p>
+ If the <a href="#dfn-Algorithm-name">name</a> member of
+ <var>normalizedAlgorithm</var> is not equal to the
+ <a href="#dfn-KeyAlgorithm-name">name</a> attribute of the
+ [[<a href="#dfn-CryptoKey-slot-algorithm">algorithm</a>]] internal slot of
+ <var>key</var> then <a href="#concept-return-an-error">return an error</a> named <a
+ href="#dfn-InvalidAccessError"><code>InvalidAccessError</code></a>.
+ </p>
+ </li>
+ <li>
+ <p>
If the [[<a href="#dfn-CryptoKey-slot-usages">usages</a>]] internal slot of
<var>key</var> does not contain an entry that is <code>"sign"</code>, then <a
href="#concept-return-an-error">return an error</a> named <a
@@ -1628,6 +1658,16 @@
</li>
<li>
<p>
+ If the <a href="#dfn-Algorithm-name">name</a> member of
+ <var>normalizedAlgorithm</var> is not equal to the
+ <a href="#dfn-KeyAlgorithm-name">name</a> attribute of the
+ [[<a href="#dfn-CryptoKey-slot-algorithm">algorithm</a>]] internal slot of
+ <var>key</var> then <a href="#concept-return-an-error">return an error</a> named <a
+ href="#dfn-InvalidAccessError"><code>InvalidAccessError</code></a>.
+ </p>
+ </li>
+ <li>
+ <p>
If the [[<a href="#dfn-CryptoKey-slot-usages">usages</a>]] internal slot of
<var>key</var> does not contain an entry that is <code>"verify"</code>, then <a
href="#concept-return-an-error">return an error</a> named <a
@@ -1883,6 +1923,16 @@
</li>
<li>
<p>
+ If the <a href="#dfn-Algorithm-name">name</a> member of
+ <var>normalizedAlgorithm</var> is not equal to the
+ <a href="#dfn-KeyAlgorithm-name">name</a> attribute of the
+ [[<a href="#dfn-CryptoKey-slot-algorithm">algorithm</a>]] internal slot of
+ <var>baseKey</var> then <a href="#concept-return-an-error">return an error</a> named <a
+ href="#dfn-InvalidAccessError"><code>InvalidAccessError</code></a>.
+ </p>
+ </li>
+ <li>
+ <p>
If the [[<a href="#dfn-CryptoKey-slot-usages">usages</a>]] internal slot of
<var>baseKey</var> does not contain an entry that is <code>"deriveKey"</code>,
then <a href="#concept-return-an-error">return an error</a> named <a
@@ -1982,6 +2032,16 @@
</li>
<li>
<p>
+ If the <a href="#dfn-Algorithm-name">name</a> member of
+ <var>normalizedAlgorithm</var> is not equal to the
+ <a href="#dfn-KeyAlgorithm-name">name</a> attribute of the
+ [[<a href="#dfn-CryptoKey-slot-algorithm">algorithm</a>]] internal slot of
+ <var>baseKey</var> then <a href="#concept-return-an-error">return an error</a> named <a
+ href="#dfn-InvalidAccessError"><code>InvalidAccessError</code></a>.
+ </p>
+ </li>
+ <li>
+ <p>
If the [[<a href="#dfn-CryptoKey-slot-usages">usages</a>]] internal slot of
<var>baseKey</var> does not contain an entry that is <code>"deriveBits"</code>,
then <a href="#concept-return-an-error">return an error</a> named <a
@@ -2265,6 +2325,16 @@
</li>
<li>
<p>
+ If the <a href="#dfn-Algorithm-name">name</a> member of
+ <var>normalizedAlgorithm</var> is not equal to the
+ <a href="#dfn-KeyAlgorithm-name">name</a> attribute of the
+ [[<a href="#dfn-CryptoKey-slot-algorithm">algorithm</a>]] internal slot of
+ <var>wrappingKey</var> then <a href="#concept-return-an-error">return an error</a> named <a
+ href="#dfn-InvalidAccessError"><code>InvalidAccessError</code></a>.
+ </p>
+ </li>
+ <li>
+ <p>
If the [[<a href="#dfn-CryptoKey-slot-usages">usages</a>]] internal slot of
<var>wrappingKey</var> does not contain an entry that is <code>"wrapKey"</code>,
then <a href="#concept-return-an-error">return an error</a> named <a
@@ -2471,6 +2541,16 @@
</li>
<li>
<p>
+ If the <a href="#dfn-Algorithm-name">name</a> member of
+ <var>normalizedAlgorithm</var> is not equal to the
+ <a href="#dfn-KeyAlgorithm-name">name</a> attribute of the
+ [[<a href="#dfn-CryptoKey-slot-algorithm">algorithm</a>]] internal slot of
+ <var>unwrappingKey</var> then <a href="#concept-return-an-error">return an error</a> named <a
+ href="#dfn-InvalidAccessError"><code>InvalidAccessError</code></a>.
+ </p>
+ </li>
+ <li>
+ <p>
If the [[<a href="#dfn-CryptoKey-slot-usages">usages</a>]] internal slot of
<var>unwrappingKey</var> does not contain an entry that is
<code>"unwrapKey"</code>, then <a href="#concept-return-an-error">return an
@@ -9455,15 +9535,6 @@
</li>
<li>
<p>
- If the <a href="#dfn-KeyAlgorithm-name">name</a> attribute of the [[<a
- href="#dfn-CryptoKey-slot-algorithm">algorithm</a>]] internal slot of
- <var>publicKey</var> is not <code>"ECDH"</code>, then <a
- href="#concept-return-an-error">return an error</a> named <a
- href="#dfn-InvalidAccessError"><code>InvalidAccessError</code></a>.
- </p>
- </li>
- <li>
- <p>
If the [[<a href="#dfn-CryptoKey-slot-type">type</a>]] internal slot of
<var>publicKey</var> is not <code>"public"</code>, then <a
href="#concept-return-an-error">return an error</a> named <a
--- a/spec/Overview.html Tue Sep 23 10:05:34 2014 -0700
+++ b/spec/Overview.html Tue Sep 23 10:43:42 2014 -0700
@@ -1368,6 +1368,15 @@
</li>
<li>
<p>
+ If the <a href="#dfn-Algorithm-name">name</a> member of
+ <var>normalizedAlgorithm</var> is not equal to the
+ <a href="#dfn-KeyAlgorithm-name">name</a> attribute of the
+ [[<a href="#dfn-CryptoKey-slot-algorithm">algorithm</a>]] internal slot of
+ <var>key</var> then <a href="#concept-return-an-error">return an error</a> named <a href="#dfn-InvalidAccessError"><code>InvalidAccessError</code></a>.
+ </p>
+ </li>
+ <li>
+ <p>
If the [[<a href="#dfn-CryptoKey-slot-usages">usages</a>]] internal slot of
<var>key</var> does not contain an entry that is <code>"encrypt"</code>, then <a href="#concept-return-an-error">return an error</a> named <a href="#dfn-InvalidAccessError"><code>InvalidAccessError</code></a>.
</p>
@@ -1449,6 +1458,15 @@
</li>
<li>
<p>
+ If the <a href="#dfn-Algorithm-name">name</a> member of
+ <var>normalizedAlgorithm</var> is not equal to the
+ <a href="#dfn-KeyAlgorithm-name">name</a> attribute of the
+ [[<a href="#dfn-CryptoKey-slot-algorithm">algorithm</a>]] internal slot of
+ <var>key</var> then <a href="#concept-return-an-error">return an error</a> named <a href="#dfn-InvalidAccessError"><code>InvalidAccessError</code></a>.
+ </p>
+ </li>
+ <li>
+ <p>
If the [[<a href="#dfn-CryptoKey-slot-usages">usages</a>]] internal slot of
<var>key</var> does not contain an entry that is <code>"decrypt"</code>, then <a href="#concept-return-an-error">return an error</a> named <a href="#dfn-InvalidAccessError"><code>InvalidAccessError</code></a>.
</p>
@@ -1529,6 +1547,15 @@
</li>
<li>
<p>
+ If the <a href="#dfn-Algorithm-name">name</a> member of
+ <var>normalizedAlgorithm</var> is not equal to the
+ <a href="#dfn-KeyAlgorithm-name">name</a> attribute of the
+ [[<a href="#dfn-CryptoKey-slot-algorithm">algorithm</a>]] internal slot of
+ <var>key</var> then <a href="#concept-return-an-error">return an error</a> named <a href="#dfn-InvalidAccessError"><code>InvalidAccessError</code></a>.
+ </p>
+ </li>
+ <li>
+ <p>
If the [[<a href="#dfn-CryptoKey-slot-usages">usages</a>]] internal slot of
<var>key</var> does not contain an entry that is <code>"sign"</code>, then <a href="#concept-return-an-error">return an error</a> named <a href="#dfn-InvalidAccessError"><code>InvalidAccessError</code></a>.
</p>
@@ -1614,6 +1641,15 @@
</li>
<li>
<p>
+ If the <a href="#dfn-Algorithm-name">name</a> member of
+ <var>normalizedAlgorithm</var> is not equal to the
+ <a href="#dfn-KeyAlgorithm-name">name</a> attribute of the
+ [[<a href="#dfn-CryptoKey-slot-algorithm">algorithm</a>]] internal slot of
+ <var>key</var> then <a href="#concept-return-an-error">return an error</a> named <a href="#dfn-InvalidAccessError"><code>InvalidAccessError</code></a>.
+ </p>
+ </li>
+ <li>
+ <p>
If the [[<a href="#dfn-CryptoKey-slot-usages">usages</a>]] internal slot of
<var>key</var> does not contain an entry that is <code>"verify"</code>, then <a href="#concept-return-an-error">return an error</a> named <a href="#dfn-InvalidAccessError"><code>InvalidAccessError</code></a>.
</p>
@@ -1864,6 +1900,15 @@
</li>
<li>
<p>
+ If the <a href="#dfn-Algorithm-name">name</a> member of
+ <var>normalizedAlgorithm</var> is not equal to the
+ <a href="#dfn-KeyAlgorithm-name">name</a> attribute of the
+ [[<a href="#dfn-CryptoKey-slot-algorithm">algorithm</a>]] internal slot of
+ <var>baseKey</var> then <a href="#concept-return-an-error">return an error</a> named <a href="#dfn-InvalidAccessError"><code>InvalidAccessError</code></a>.
+ </p>
+ </li>
+ <li>
+ <p>
If the [[<a href="#dfn-CryptoKey-slot-usages">usages</a>]] internal slot of
<var>baseKey</var> does not contain an entry that is <code>"deriveKey"</code>,
then <a href="#concept-return-an-error">return an error</a> named <a href="#dfn-InvalidAccessError"><code>InvalidAccessError</code></a>.
@@ -1962,6 +2007,15 @@
</li>
<li>
<p>
+ If the <a href="#dfn-Algorithm-name">name</a> member of
+ <var>normalizedAlgorithm</var> is not equal to the
+ <a href="#dfn-KeyAlgorithm-name">name</a> attribute of the
+ [[<a href="#dfn-CryptoKey-slot-algorithm">algorithm</a>]] internal slot of
+ <var>baseKey</var> then <a href="#concept-return-an-error">return an error</a> named <a href="#dfn-InvalidAccessError"><code>InvalidAccessError</code></a>.
+ </p>
+ </li>
+ <li>
+ <p>
If the [[<a href="#dfn-CryptoKey-slot-usages">usages</a>]] internal slot of
<var>baseKey</var> does not contain an entry that is <code>"deriveBits"</code>,
then <a href="#concept-return-an-error">return an error</a> named <a href="#dfn-InvalidAccessError"><code>InvalidAccessError</code></a>.
@@ -2231,6 +2285,15 @@
</li>
<li>
<p>
+ If the <a href="#dfn-Algorithm-name">name</a> member of
+ <var>normalizedAlgorithm</var> is not equal to the
+ <a href="#dfn-KeyAlgorithm-name">name</a> attribute of the
+ [[<a href="#dfn-CryptoKey-slot-algorithm">algorithm</a>]] internal slot of
+ <var>wrappingKey</var> then <a href="#concept-return-an-error">return an error</a> named <a href="#dfn-InvalidAccessError"><code>InvalidAccessError</code></a>.
+ </p>
+ </li>
+ <li>
+ <p>
If the [[<a href="#dfn-CryptoKey-slot-usages">usages</a>]] internal slot of
<var>wrappingKey</var> does not contain an entry that is <code>"wrapKey"</code>,
then <a href="#concept-return-an-error">return an error</a> named <a href="#dfn-InvalidAccessError"><code>InvalidAccessError</code></a>.
@@ -2431,6 +2494,15 @@
</li>
<li>
<p>
+ If the <a href="#dfn-Algorithm-name">name</a> member of
+ <var>normalizedAlgorithm</var> is not equal to the
+ <a href="#dfn-KeyAlgorithm-name">name</a> attribute of the
+ [[<a href="#dfn-CryptoKey-slot-algorithm">algorithm</a>]] internal slot of
+ <var>unwrappingKey</var> then <a href="#concept-return-an-error">return an error</a> named <a href="#dfn-InvalidAccessError"><code>InvalidAccessError</code></a>.
+ </p>
+ </li>
+ <li>
+ <p>
If the [[<a href="#dfn-CryptoKey-slot-usages">usages</a>]] internal slot of
<var>unwrappingKey</var> does not contain an entry that is
<code>"unwrapKey"</code>, then <a href="#concept-return-an-error">return an
@@ -9123,12 +9195,6 @@
</li>
<li>
<p>
- If the <a href="#dfn-KeyAlgorithm-name">name</a> attribute of the [[<a href="#dfn-CryptoKey-slot-algorithm">algorithm</a>]] internal slot of
- <var>publicKey</var> is not <code>"ECDH"</code>, then <a href="#concept-return-an-error">return an error</a> named <a href="#dfn-InvalidAccessError"><code>InvalidAccessError</code></a>.
- </p>
- </li>
- <li>
- <p>
If the [[<a href="#dfn-CryptoKey-slot-type">type</a>]] internal slot of
<var>publicKey</var> is not <code>"public"</code>, then <a href="#concept-return-an-error">return an error</a> named <a href="#dfn-InvalidAccessError"><code>InvalidAccessError</code></a>.
</p>