Hi Stefan,

I am assuming that the signed XML file contains the X.509 certificate data in base-64 format. I also assume that you can extract the base-64 certificate data from the XML file. Given the base-64 X.509 certificate data, you can show the certificate using the Firefox certificate viewer as follows:

function showX509Base64Cert(/* string */ aBase64CertData)
{
// Note: This is Mozilla application (FF, TB, SM etc,) specific code - will not work on IE, Safari, Chrome.

// Un-comment the 'netscape.security....' line if you are using this function in a dowloaded html/js file. // Also, set the 'signed.applets.codebase_principal_support' preferece to true (using about:config) // netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');

   // Obtain the reference to X.509 Certificate DB
var /* nsIX509CertDB */ x509CertDB = Components.classes["@mozilla.org/security/x509certdb;1"] .getService(Components.interfaces.nsIX509CertDB);

    // Use the  Base-64 certificate data to get  nsIX509Cert reference
// For more info : http://mxr.mozilla.org/mozilla-central/source/security/manager/ssl/public/nsIX509CertDB.idl#298 var /* nsIX509Cert */ x509Cert = x509CertDB.constructX509FromBase64(aBase64CertData);

   // show the cert using Certificate dialog
// For more info: http://mxr.mozilla.org/mozilla-central/source/security/manager/ssl/public/nsICertificateDialogs.idl
    var cd = Components.classes["@mozilla.org/nsCertificateDialogs;1"]
.getService(Components.interfaces.nsICertificateDialogs);
   cd.viewCert(window, x509Cert);
}

--
Subrata

Stefan Jordanov wrote:
On 4 Дек, 22:16, Peter Djalaliev <peter.djalal...@gmail.com> wrote:
Firefox Certificate window

On 24 ????, 17:49, Stefan Jordanov <stefanste...@gmail.com> wrote:



As as say Firefix certificate window I mean Firefox certificate
viewer.
Best regards, Stefan Jordanov On 24 ????, 17:45, Stefan Jordanov <stefanste...@gmail.com> wrote:
Hello everybody,
I am wondering how can I show a X509Certificate with javascript or
something like that in the Firefox certificate window?
Is this possible with window.crypto? Thank you in advance. Best regards, Stefan Jordanov
May be I have mistaken the group. People if so, please let me know.
Br
Stefan
Hi, Stefan

What exactly are you trying to do?

PSM defines a number of XUL interfaces you can use: nsIX509Cert,
nsIX509Cert2, nsIX509Cert3.  It looks like they are all scriptable, so you
can access them through JavaScript.

Where do you want to get a certificate from and where do you want to display
it?  Are you working from within a Firefox extension or something else...
Please, provide more information.

Regards,


Hello,

Thank ypu for your answers. I am traying to get the certificate from a
signed xml file. I have a xslt transformation attached to the signed
xml. I would like to have a link on the transformed html file. Whe
someone click on the link I would like to popup the Firefox
certificate viewer.

Again thank you all.
--
dev-tech-crypto mailing list
dev-tech-crypto@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-tech-crypto

Reply via email to