This feature is not Baseline because it does not work in some of the most widely-used browsers.
The RTCCertificateStats dictionary of the WebRTC API is used to report information about a certificate used by an RTCDtlsTransport and its underlying RTCIceTransport.
The report can be obtained by iterating the RTCStatsReport returned by RTCPeerConnection.getStats() until you find an entry with the type of certificate.
fingerprintA string containing the certificate fingerprint, which is calculated using the hash function specified in fingerprintAlgorithm.
fingerprintAlgorithmA string containing the hash function used to compute the certificate fingerprint, such as "sha-256".
base64CertificateA string containing the base-64 representation of the DER-encoded certificate.
The following properties are common to all WebRTC statistics objects (See RTCStatsReport for more information).
idA string that uniquely identifies the object that is being monitored to produce this set of statistics.
timestampA DOMHighResTimeStamp object indicating the time at which the sample was taken for this statistics object.
typeA string with the value "certificate", indicating the type of statistics that the object contains.
Given a variable myPeerConnection, which is an instance of RTCPeerConnection, the code below uses await to wait for the statistics report, and then iterates it using RTCStatsReport.forEach(). It then filters the dictionaries for just those reports that have the type of certificate and logs the result.
const stats = await myPeerConnection.getStats();
stats.forEach((report) => {
if (report.type === "certificate") {
// Log the certificate information
console.log(report);
}
});
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
RTCCertificateStats |
80 | 80 | No | 67 | 13.1 | 80 | No | 57 | 13.4 | 13.0 | 80 | 13.4 |
base64Certificate |
80 | 80 | No | 67 | 13.1 | 80 | No | 57 | 13.4 | 13.0 | 80 | 13.4 |
fingerprint |
80 | 80 | No | 67 | 13.1 | 80 | No | 57 | 13.4 | 13.0 | 80 | 13.4 |
fingerprintAlgorithm |
80 | 80 | No | 67 | 13.1 | 80 | No | 57 | 13.4 | 13.0 | 80 | 13.4 |
id |
80 | 80 | No | 67 | 13.1 | 80 | No | 57 | 13.4 | 13.0 | 80 | 13.4 |
timestamp |
80 | 80 | No | 67 | 13.1 | 80 | No | 57 | 13.4 | 13.0 | 80 | 13.4 |
type |
80 | 80 | No | 67 | 13.1 | 80 | No | 57 | 13.4 | 13.0 | 80 | 13.4 |
© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/RTCCertificateStats