The generateCertificate()
method of the RTCPeerConnection
interface creates and stores an X.509 certificate and corresponding private key then returns an RTCCertificate
, providing access to it.
Syntax
var cert = RTCPeerConnection.generateCertificate(keygenAlgorithm)
Parameters
keygenAlgorithm
- A
DOMString
identifying the algorithm to use in creating the key.
RTCPeerConnection.generateCertificate()
is a static method, so it is always called on the RTCPeerConnection
interface itself, not an instance thereof.
Return value
A reference to an RTCCertificate
object.
Example
RTCPeerConnection.generateCertificate({ name: 'RSASSA-PKCS1-v1_5', hash: 'SHA-256', modulusLength: 2048, publicExponent: new Uint8Array([1, 0, 1]) }).then(function(cert) { var pc = new RTCPeerConnection({certificates: [cert]}); });
Specifications
Specification | Status | Comment |
---|---|---|
WebRTC 1.0: Real-time Communication Between Browsers The definition of 'generateCertificate()' in that specification. |
Candidate Recommendation | Initial definition. |
Browser compatibility
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Feature | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|---|
Basic support | 56 | Yes | 22 | ? | 431 37 — 43 | ? |
Feature | Android webview | Chrome for Android | Edge mobile | Firefox for Android | Opera Android | iOS Safari | Samsung Internet |
---|---|---|---|---|---|---|---|
Basic support | 56 | 56 | Yes | 44 | 431 37 — 43 | ? | 6.0 |
1. Promise based version.