这篇文章需要技术复核。如何帮忙。
我们的志愿者还没有将这篇文章翻译为 中文 (简体)。加入我们帮助完成翻译!
This is an experimental technology
Because this technology's specification has not stabilized, check the compatibility table for usage in various browsers. Also note that the syntax and behavior of an experimental technology is subject to change in future versions of browsers as the specification changes.
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 Browser The definition of 'generateCertificate()' in that specification. |
Working Draft | Initial definition. |
Browser compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
---|---|---|---|---|---|
Basic support | 52.0 [1] | 42 (42) | ? | 39 | ? |
Feature | Android | Android Webview | Firefox Mobile (Gecko) | Firefox OS | IE Mobile | Opera Mobile | Safari Mobile | Chrome for Android |
---|---|---|---|---|---|---|---|---|
Basic support | No support | 52.0 [1] | 42.0 (42) | ? | ? | 39 | ? | 52.0 [1] |
[1] Behind a flag starting with Chrome 48.