implementation of OnSelectClientCertificate handler?

Having problems with building or using the JCEF Java binding? Ask your questions here.

implementation of OnSelectClientCertificate handler?

Postby darius » Sun Jan 05, 2020 3:20 pm

Hello,

I'm porting a CEF project from C# to Java but i can't find the OnSelectClientCertificate handler. Could you please advice or help me ?

Thanks in advance

David L.
darius
Techie
 
Posts: 16
Joined: Sun Jan 05, 2020 3:16 pm

Re: implementation of OnSelectClientCertificate handler?

Postby magreenblatt » Sun Jan 05, 2020 3:32 pm

This method is not currently exposed in JCEF. You can implement it by following the pattern of existing methods.
magreenblatt
Site Admin
 
Posts: 12382
Joined: Fri May 29, 2009 6:57 pm

Re: implementation of OnSelectClientCertificate handler?

Postby darius » Tue Jan 07, 2020 2:24 am

Ok, let's try to implement it , being a beginner with JNI ...Could you please explain the JNI_CALL_METHOD and why the java signatures (in request_handler.cpp for example) are not always in full...
darius
Techie
 
Posts: 16
Joined: Sun Jan 05, 2020 3:16 pm

Re: implementation of OnSelectClientCertificate handler?

Postby magreenblatt » Tue Jan 07, 2020 3:43 am

The signatures are generated by the javap tool. See here and here.
magreenblatt
Site Admin
 
Posts: 12382
Joined: Fri May 29, 2009 6:57 pm

Re: implementation of OnSelectClientCertificate handler?

Postby darius » Thu Jan 09, 2020 2:20 am

Hello All,

I'd like to request your advice :

For the conversion from type java.security.cert.X509Certificate to CefX509Certificate and vice versa
, what would be the more effective way ? (via PEM, via DER,....)?
Could you please send a sample for each advice ?

Thanks in advance

Darius
darius
Techie
 
Posts: 16
Joined: Sun Jan 05, 2020 3:16 pm

Re: implementation of OnSelectClientCertificate handler?

Postby magreenblatt » Thu Jan 09, 2020 6:49 am

It looks like X509Certificate.getInstance requires DER-encoded data.
magreenblatt
Site Admin
 
Posts: 12382
Joined: Fri May 29, 2009 6:57 pm

Re: implementation of OnSelectClientCertificate handler?

Postby darius » Thu Jan 09, 2020 7:00 am

good, that part was easy ... but how to inject DER-encoded Data into the CefX509Certificate (C++ part) ?
darius
Techie
 
Posts: 16
Joined: Sun Jan 05, 2020 3:16 pm

Re: implementation of OnSelectClientCertificate handler?

Postby magreenblatt » Thu Jan 09, 2020 7:20 am

The CefX509Certificate object is read-only. If you're asking how to identify the CefX509Certificate for passage to CefSelectClientCertificateCallback::Select I would suggest keeping the index in order to retrieve the original object.
magreenblatt
Site Admin
 
Posts: 12382
Joined: Fri May 29, 2009 6:57 pm

Re: implementation of OnSelectClientCertificate handler?

Postby darius » Sun Jan 19, 2020 6:18 am

Hello,
I've added the following hook inside request_handler.cpp and in request_handler.h :
bool RequestHandler::OnSelectClientCertificate(
CefRefPtr<CefBrowser> browser,
bool isProxy,
const CefString& host,
int port,
const X509CertificateList& certificates,
CefRefPtr<CefSelectClientCertificateCallback> callback)
but it's never tiggered when navigating to a site requiring client auth, what could i miss ?
darius
Techie
 
Posts: 16
Joined: Sun Jan 05, 2020 3:16 pm

Re: implementation of OnSelectClientCertificate handler?

Postby darius » Sun Jan 19, 2020 7:06 am

Sorry, it was a glitch of my xcode debug ... the hook works without issue. You told me that i should keep an index ok but where should i retrieve the
const X509CertificateList& certificates (coming in the OnSelectClientCertificate hook) ? Or where should i store it ? To get access to it in the select call back ....
darius
Techie
 
Posts: 16
Joined: Sun Jan 05, 2020 3:16 pm

Next

Return to JCEF Forum

Who is online

Users browsing this forum: Google [Bot] and 22 guests