Skip to content

Commit 432f094

Browse files
hopafoottwiss
andauthored
Check length when importing raw X25519 and Ed25519 keys (#410)
RFC7748 and RFC8032 specify that X25519 and Ed25519 public keys are 32 bytes/256 bits. The spec, however, does not explicitly reject raw keys of different lengths. This patch adds checks for the length. This behavior is already being tested for by WPT and implementations already throw a DataError in such cases. Co-authored-by: Daniel Huigens <d.huigens@protonmail.com>
1 parent 37f41ce commit 432f094

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

spec/Overview.html

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10931,6 +10931,13 @@ <h5>Import Key</h5>
1093110931
{{SyntaxError}}.
1093210932
</p>
1093310933
</li>
10934+
<li>
10935+
<p>
10936+
If the [= length in bits =] of |keyData|
10937+
is not 256 then [= exception/throw =] a
10938+
{{DataError}}.
10939+
</p>
10940+
</li>
1093410941
<li>
1093510942
<p>
1093610943
Let |algorithm| be a new {{KeyAlgorithm}} object.
@@ -11775,6 +11782,13 @@ <h5>Import Key</h5>
1177511782
{{SyntaxError}}.
1177611783
</p>
1177711784
</li>
11785+
<li>
11786+
<p>
11787+
If the [= length in bits =] of |keyData|
11788+
is not 256 then [= exception/throw =] a
11789+
{{DataError}}.
11790+
</p>
11791+
</li>
1177811792
<li>
1177911793
<p>
1178011794
Let |algorithm| be a new {{KeyAlgorithm}} object.

0 commit comments

Comments
 (0)