Here is the code (browser Chrome on Ubuntu):
RTCPeerConnection.generateCertificate(
{ name: "RSASSA-PKCS1-v1_5",
modulusLength: 2048,
publicExponent: new Uint8Array([1, 0, 1]),
hash: "SHA-256" })
.then
( function(cert) {
console.log("typeof: " + typeof(cert));
console.log("S: " + JSON.stringify(cert));
},
function(err) {
console.log("E: " + err);
}
);
It displays:
typeof: object
S: {}
Actually this is almost the exact code from Mozilla site
Also, conforms to the WebRTC specs Section 4.9