Re: Clarification on nsHTMLInputElement/ certificates

Anderson Walls <[email protected]> Thu, 19 Apr 2012 12:10:15 -0700 (PDT)
Newsgroups gmane.comp.mozilla.devel.dom
Organization http://groups.google.com
Message-ID <6eff1923-06fd-4729-ae5a-a4362b0823f9@l18g2000vbx.googlegroups.com>
On Apr 18, 10:59=A0am, Boris Zbarsky <[email protected]> wrote:
> On 4/18/12 9:23 AM, Anderson Walls wrote:
>
> > // start of my addition
> > if( IsPasswordTextControl() ){
> > =A0 =A0std::cerr<< =A0"Entered Password Field"<< =A0std::endl;
> > }
>
> > // continue mozilla source
>
> > So I now know when ever I have clicked into a password field which is
> > great but I have been trying for the last few weeks to sift through
> > the DOM in order to find where I can grab the certificate or determine
> > that there is not one for the document/tab/frame that the user is
> > currently in
>
> Getting a representation of the certificate for the "tab" is a bit of wor=
k.
>
> Getting it for the document the <input> is in goes like this:
>
> =A0 =A0nsCOMPtr<nsISupports> cert;
> =A0 =A0NodePrincipal()->GetCertificate(getter_AddRefs(cert));
> =A0 =A0if (cert) {
> =A0 =A0 =A0// Can now QI cert to nsIX509Cert, nsIX509Cert2, nsIX509Cert3,
> =A0 =A0 =A0// extract whatever you want.
> =A0 =A0}
>
> -Boris

Thanks for the helpful reply Boris.

Would you be able to tell me how to take cert and literally print out
the x509 cert to stderr, PEM, DEM, doesn't matter the format I can
script it pem with openssl. Been looking through the security
directory trying to figure out the mozilla query interface and it is
giving me some trouble and you would look like the guy who could tell
me where to go.

My use for Mozilla in my project is very simple, I need the browser to
just give me the x509 cert as is when I click into a password field,
from there the rest of my project is set up to do various other things
with cert verification fully independent for mozilla. This is the last
piece of project that needs to come together.

If you could please reply it would be greatly appreciated, I am
definitely on the right path to where I need to be now.

-Anderson