File: crypto-suite.https.html

package info (click to toggle)
firefox 143.0.3-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 4,617,328 kB
  • sloc: cpp: 7,478,492; javascript: 6,417,157; ansic: 3,720,058; python: 1,396,372; xml: 627,523; asm: 438,677; java: 186,156; sh: 63,477; makefile: 19,171; objc: 13,059; perl: 12,983; yacc: 4,583; cs: 3,846; pascal: 3,405; lex: 1,720; ruby: 1,003; exp: 762; php: 436; lisp: 258; awk: 247; sql: 66; sed: 53; csh: 10
file content (79 lines) | stat: -rw-r--r-- 2,794 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<!doctype html>
<meta charset=utf-8>
<title>RTCPeerConnection.prototype.createOffer</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../RTCPeerConnection-helper.js"></script>
<script>
'use strict';

// draft-ietf-rtcweb-security-20 section 6.5
//
// All Implementations MUST support DTLS 1.2 with the
// TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 cipher suite and the P-256
// curve [FIPS186].
//   .......  The DTLS-SRTP protection profile
// SRTP_AES128_CM_HMAC_SHA1_80 MUST be supported for SRTP.
// Implementations MUST favor cipher suites which support (Perfect
// Forward Secrecy) PFS over non-PFS cipher suites and SHOULD favor AEAD
// over non-AEAD cipher suites.

const acceptableTlsVersions = new Set([
  'FEFD', // DTLS 1.2 - RFC 6437 section 4.1
  '0304', // TLS 1.3 - RFC 8446 section 5.1
  'FEFC', // DTLS 1.3 - RFC 9147 section 5.3
]);

const acceptableDtlsCiphersuites = new Set([
  'TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256',
  'TLS_AES_128_GCM_SHA256',
]);

const acceptableSrtpCiphersuites = new Set([
  'SRTP_AES128_CM_HMAC_SHA1_80',
  'AES_CM_128_HMAC_SHA1_80',
]);

const acceptableValues = {
  'tlsVersion': acceptableTlsVersions,
  'dtlsCipher': acceptableDtlsCiphersuites,
  'srtpCipher': acceptableSrtpCiphersuites,
};

function verifyStat(name, transportStats) {
  assert_not_equals(typeof transportStats, 'undefined');
  assert_true(name in transportStats, 'Value present:');
  assert_true(acceptableValues[name].has(transportStats[name]));
}

for (const name of Object.keys(acceptableValues)) {
  promise_test(async t => {
    const pc1 = new RTCPeerConnection();
    const pc2 = new RTCPeerConnection();
    t.add_cleanup(() => pc1.close());
    t.add_cleanup(() => pc2.close());
    pc1.createDataChannel('foo');
    exchangeIceCandidates(pc1, pc2);
    await exchangeOfferAnswer(pc1, pc2);
    await waitForState(pc1.sctp.transport, 'connected');
    const statsReport = await pc1.getStats();
    const transportStats = [...statsReport.values()].find(({type}) => type === 'transport');
    verifyStat(name, transportStats);
  }, name + ' is acceptable on data-only');

  promise_test(async t => {
    const pc1 = new RTCPeerConnection();
    const pc2 = new RTCPeerConnection();
    t.add_cleanup(() => pc1.close());
    t.add_cleanup(() => pc2.close());
    const transceiver = pc1.addTransceiver('video');

    exchangeIceCandidates(pc1, pc2);
    await exchangeOfferAnswer(pc1, pc2);
    await waitForState(transceiver.sender.transport, 'connected');
    const statsReport = await pc1.getStats();
    const transportStats = [...statsReport.values()].find(({type}) => type === 'transport');
    verifyStat(name, transportStats);
  }, name + ' is acceptable on video-only');
}
</script>