Skip to content

Commit

Permalink
Reland "webrtc wpt: add test for RSA keysizes supported by generateCe…
Browse files Browse the repository at this point in the history
…rtificate"

This is a reland of commit 4ed65e8472a746b369fe8bc6c4b862dd3a7cb780
setting the long timeout flag and restrict to 1024 and 2048 bits.

Original change's description:
> webrtc wpt: add test for RSA keysizes supported by generateCertificate
>
> testing 1024 (not good), 2048, 4096 and 8192 bit keys
>
> BUG=webrtc:364338811
>
> Change-Id: I94320a47c07f2ba2b6338a5d364470c69ef6a5bc
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5836127
> Reviewed-by: Guido Urdaneta <guidou@chromium.org>
> Commit-Queue: Philipp Hancke <philipp.hancke@googlemail.com>
> Reviewed-by: Harald Alvestrand <hta@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1352010}

Bug: webrtc:364338811
Change-Id: Ibafe0e7b1bb712ce49646da98baf0e6bf405be59
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5842681
Reviewed-by: Guido Urdaneta <guidou@chromium.org>
Reviewed-by: Harald Alvestrand <hta@chromium.org>
Commit-Queue: Philipp Hancke <philipp.hancke@googlemail.com>
Cr-Commit-Position: refs/heads/main@{#1352583}
  • Loading branch information
fippo authored and chromium-wpt-export-bot committed Sep 9, 2024
1 parent ec9b870 commit 9134220
Showing 1 changed file with 17 additions and 13 deletions.
30 changes: 17 additions & 13 deletions webrtc/RTCPeerConnection-generateCertificate.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<!doctype html>
<meta charset="utf-8">
<meta name="timeout" content="long">
<title>Test RTCPeerConnection.generateCertificate</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
Expand Down Expand Up @@ -33,20 +34,23 @@
* publicExponent: new Uint8Array([1, 0, 1]), hash: "SHA-256" },
* and { name: "ECDSA", namedCurve: "P-256" }.
*/
promise_test(t =>
RTCPeerConnection.generateCertificate({
name: 'RSASSA-PKCS1-v1_5',
modulusLength: 2048,
publicExponent: new Uint8Array([1, 0, 1]),
hash: 'SHA-256'
}).then(cert => {
assert_true(cert instanceof RTCCertificate,
'Expect cert to be instance of RTCCertificate');
[1024, 2048].forEach(modulusLength => {
promise_test(t =>
// Test common RSA key sizes. Only 2048 is mandatory to support.
RTCPeerConnection.generateCertificate({
name: 'RSASSA-PKCS1-v1_5',
modulusLength,
publicExponent: new Uint8Array([1, 0, 1]),
hash: 'SHA-256'
}).then(cert => {
assert_true(cert instanceof RTCCertificate,
'Expect cert to be instance of RTCCertificate');

assert_greater_than(cert.expires, Date.now(),
'Expect generated certificate to expire reasonably long after current time');
}),
'generateCertificate() with compulsary RSASSA-PKCS1-v1_5 parameters should succeed');
assert_greater_than(cert.expires, Date.now(),
'Expect generated certificate to expire reasonably long after current time');
}),
`generateCertificate({modulusLength: ${modulusLength}}) with RSASSA-PKCS1-v1_5 parameters should succeed`);
});

promise_test(t =>
RTCPeerConnection.generateCertificate({
Expand Down

0 comments on commit 9134220

Please sign in to comment.