Bug 892148 - Make DTLS fingerprint accessible from JS r=abr

This commit is contained in:
Max Jonas Werner 2013-12-04 15:36:00 -06:00
parent 800f836ccb
commit d0f3485699
3 changed files with 13 additions and 3 deletions

View File

@ -67,6 +67,7 @@ interface PeerConnectionImpl {
void close();
/* Attributes */
readonly attribute DOMString fingerprint;
readonly attribute DOMString localDescription;
readonly attribute DOMString remoteDescription;

View File

@ -787,7 +787,7 @@ PeerConnectionImpl::Initialize(PeerConnectionObserver& aObserver,
// DTLS identity
unsigned char fingerprint[DTLS_FINGERPRINT_LENGTH];
size_t fingerprint_length;
res = mIdentity->ComputeFingerprint("sha-1",
res = mIdentity->ComputeFingerprint("sha-256",
fingerprint,
sizeof(fingerprint),
&fingerprint_length);
@ -798,7 +798,7 @@ PeerConnectionImpl::Initialize(PeerConnectionObserver& aObserver,
return res;
}
mFingerprint = "sha-1 " + mIdentity->FormatFingerprint(fingerprint,
mFingerprint = "sha-256 " + mIdentity->FormatFingerprint(fingerprint,
fingerprint_length);
if (NS_FAILED(res)) {
CSFLogError(logTag, "%s: do_GetService failed: %u",
@ -1340,6 +1340,7 @@ PeerConnectionImpl::SetRemoteFingerprint(const char* hash, const char* fingerpri
return NS_ERROR_FAILURE;
}
}
*/
NS_IMETHODIMP
PeerConnectionImpl::GetFingerprint(char** fingerprint)
@ -1357,7 +1358,6 @@ PeerConnectionImpl::GetFingerprint(char** fingerprint)
*fingerprint = tmp;
return NS_OK;
}
*/
NS_IMETHODIMP
PeerConnectionImpl::GetLocalDescription(char** aSDP)

View File

@ -346,6 +346,15 @@ public:
rv = RemoveStream(aMediaStream);
}
NS_IMETHODIMP GetFingerprint(char** fingerprint);
void GetFingerprint(nsAString& fingerprint)
{
char *tmp;
GetFingerprint(&tmp);
fingerprint.AssignASCII(tmp);
delete[] tmp;
}
NS_IMETHODIMP GetLocalDescription(char** aSDP);
void GetLocalDescription(nsAString& aSDP)