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.
var cert = RTCPeerConnection.generateCertificate(keygenAlgorithm)
keygenAlgorithm
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.
A reference to an RTCCertificate
object.
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]}); });
Specification | Status | Comment |
---|---|---|
WebRTC 1.0: Real-time Communication Between Browsers The definition of 'generateCertificate()' in that specification. | Working Draft | Initial definition. |
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
---|---|---|---|---|---|
Basic support | 49 [1] | 42 (42) | ? | 36 | ? |
Feature | Android Webview | Chrome for Android | Firefox Mobile (Gecko) | Firefox OS | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|---|
Basic support | 49 [1] | 49 [1] | 42.0 (42) | ? | ? | 36 | ? |
[1] Though this method is not prefixed, the interface it belongs to was until Chrome 56.
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/generateCertificate