Reputation: 4630
I am developing a Firefox extension where I need to know the level of SSL encryption of a web page that is loaded. (whether it is a 128 bit encryption or 256 bit encryption).
Basically I need to detect whether the given page is a secure payment page.
Any idea how this could be done?
Upvotes: 1
Views: 265
Reputation: 57661
What you need is the nsISSLStatus
interface. You can get it for a page loaded into a <browser>
element or the current tab of a <tabbrowser>
element (e.g. gBrowser
if you want the <tabbrowser>
element in the Firefox browser window) like this:
var status = gBrowser.securityUI
.QueryInterface(Components.interfaces.nsISSLStatusProvider)
.SSLStatus;
if (status && !status.isUntrusted)
{
alert("Cipher: " + status.cipherName);
alert("Key length: " + status.keyLength);
}
Please don't look at the key length without looking at the cipher used - the key length alone is meaningless.
Upvotes: 2