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
DOMStringidentifying 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.
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
generateCertificate | Chrome Full support 48 | Edge Full support ≤18 | Firefox Full support 22 | IE No support No | Opera
Full support
43
| Safari ? | WebView Android Full support 48 | Chrome Android Full support 48 | Firefox Android Full support 44 | Opera Android
Full support
43
| Safari iOS ? | Samsung Internet Android Full support 6.0 |
Legend
- Full support
- Full support
- No support
- No support
- Compatibility unknown
- Compatibility unknown
- See implementation notes.
- See implementation notes.
