Re: Clarification on nsHTMLInputElement/ certificates

Anderson Walls <[email protected]> Thu, 19 Apr 2012 18:42:34 -0700 (PDT)
Newsgroups gmane.comp.mozilla.devel.dom
Organization http://groups.google.com
Message-ID <[email protected]>
On Apr 19, 3:30=A0pm, Boris Zbarsky <[email protected]> wrote:
> On 4/19/12 3:10 PM, Anderson Walls wrote:
>
>
>
>
>
>
>
>
>
> >> Getting it for the document the<input> =A0is in goes like this:
>
> >> =A0 =A0 nsCOMPtr<nsISupports> =A0cert;
> >> =A0 =A0 NodePrincipal()->GetCertificate(getter_AddRefs(cert));
> >> =A0 =A0 if (cert) {
> >> =A0 =A0 =A0 // Can now QI cert to nsIX509Cert, nsIX509Cert2, nsIX509Ce=
rt3,
> >> =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.
>
> I can get you DER. =A0Would that be good enough?
>
> Starting with the above code:
>
> =A0 =A0nsCOMPtr<nsIX509Cert> c =3D do_QueryInterface(cert);
> =A0 =A0PRUint32 length;
> =A0 =A0PRUint8* data;
> =A0 =A0c->GetRawDER(&length, &data);
> =A0 =A0// Do whatever you want with the data; write it to files, whatever
> =A0 =A0NS_Free(data);
>
> -Boris

Boris once again thank you so much, that is exactly what I needed. DER
will do just fine, converting is simple with openssl. Thank you so
much for your assistance sir.

-Anderson Walls