On 8 Дек, 04:42, Subrata Mazumdar <subrata.mazum...@ieee.org> wrote:
> Hi Stefan,
>
> I am assuming that the signed XML file contains the X.509certificate
> data in base-64 format.
> I also assume that you can extract the base-64certificatedata from the
> XML file.
> Given the base-64 X.509certificatedata, you can show thecertificate
> using the Firefoxcertificatevieweras 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.509CertificateDB
>     var /* nsIX509CertDB */ x509CertDB =
> Components.classes["@mozilla.org/security/x509certdb;1"]
>
> .getService(Components.interfaces.nsIX509CertDB);
>
>      // Use the  Base-64certificatedata to get  nsIX509Cert reference
>      // For more info 
> :http://mxr.mozilla.org/mozilla-central/source/security/manager/ssl/pu...
>
>      var /* nsIX509Cert */ x509Cert =
> x509CertDB.constructX509FromBase64(aBase64CertData);
>
>     // show the cert usingCertificatedialog
>     // For more 
> info:http://mxr.mozilla.org/mozilla-central/source/security/manager/ssl/pu...
>
>      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:
>
> >> FirefoxCertificatewindow
>
> >> On 24 ????, 17:49, Stefan Jordanov <stefanste...@gmail.com> wrote:
>
> >>>> As as say Firefixcertificatewindow I mean Firefoxcertificate
> >>>>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 Firefoxcertificatewindow?
>
> >>>>> 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 acertificatefrom 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 thecertificatefrom 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
> >certificateviewer.
>
> > Again thank you all.

Dear Subrata,

Thank you very much for your reply. That was just what I was asking.
You code worked fine for me.

Stefan
-- 
dev-tech-crypto mailing list
dev-tech-crypto@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-tech-crypto

Reply via email to