implementation of OnSelectClientCertificate handler?

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

Re: implementation of OnSelectClientCertificate handler?

Postby darius » Fri Jan 24, 2020 4:45 am

Hello, implementing the handler, i encounter this issue with a BEid smart card :

The GetDEREncodedIssuerChain method always give me an empty array ...The GetDEREncoded give the certificate of the citizen
Normally the belgian eid cards have 3 certificates in their full chain (one for the citizen and 2 CA)
Is it normal or is it a bug ? This phenomenon occurs in Mac OS x ... I don't know how it behaves in other environments
darius
Techie
 
Posts: 16
Joined: Sun Jan 05, 2020 3:16 pm

Re: implementation of OnSelectClientCertificate handler?

Postby magreenblatt » Fri Jan 24, 2020 9:25 am

darius wrote:Hello, implementing the handler, i encounter this issue with a BEid smart card :

The GetDEREncodedIssuerChain method always give me an empty array ...The GetDEREncoded give the certificate of the citizen
Normally the belgian eid cards have 3 certificates in their full chain (one for the citizen and 2 CA)
Is it normal or is it a bug ? This phenomenon occurs in Mac OS x ... I don't know how it behaves in other environments

I don't know. You can try asking on the Chromium net-dev mailing list.
magreenblatt
Site Admin
 
Posts: 9831
Joined: Fri May 29, 2009 6:57 pm

Re: implementation of OnSelectClientCertificate handler?

Postby darius » Fri Jan 24, 2020 10:39 am

Ok, i'll work without these extra certs... (I check the chain before the navigation)

Now, i'm stuck with my previous question... In the c++ callback (CefSelectClientCertificateCallback_N.cpp), i've retrieved the selected certificate index from the Java.

But i can't figure how to retrieve the const X509CertificateList& certificates given initially to the hook

bool RequestHandler::OnSelectClientCertificate(
CefRefPtr<CefBrowser> browser,
bool isProxy,
const CefString& host,
int port,
const X509CertificateList& certificates,
CefRefPtr<CefSelectClientCertificateCallback> callback)
darius
Techie
 
Posts: 16
Joined: Sun Jan 05, 2020 3:16 pm

Re: implementation of OnSelectClientCertificate handler?

Postby magreenblatt » Fri Jan 24, 2020 12:34 pm

Can you upload a PR with your changes so far?
magreenblatt
Site Admin
 
Posts: 9831
Joined: Fri May 29, 2009 6:57 pm

Re: implementation of OnSelectClientCertificate handler?

Postby darius » Fri Jan 24, 2020 5:38 pm

Of course ... Here it is...commit 0dae895 (it's a draft )
darius
Techie
 
Posts: 16
Joined: Sun Jan 05, 2020 3:16 pm

Re: implementation of OnSelectClientCertificate handler?

Postby darius » Mon Jan 27, 2020 11:06 am

Ok ... it think i've got it .... I'm using now a ByteBuffer to keep the reference to the background CefX509Certificate.(commit 331132f)
darius
Techie
 
Posts: 16
Joined: Sun Jan 05, 2020 3:16 pm

Re: implementation of OnSelectClientCertificate handler?

Postby magreenblatt » Mon Jan 27, 2020 11:22 am

darius wrote:Ok ... it think i've got it .... I'm using now a ByteBuffer to keep the reference to the background CefX509Certificate.(commit 331132f)

I think you have the right idea, but you can store a pointer to the certificate in a long. See usage of CefNativeAdapter for an example. Make sure to remove the reference on execution of the callback, or in response to finalize().
magreenblatt
Site Admin
 
Posts: 9831
Joined: Fri May 29, 2009 6:57 pm

Re: implementation of OnSelectClientCertificate handler?

Postby darius » Fri Jan 31, 2020 9:29 am

Hello,

In my last commit 2672d49 (PR implementation of OnSelectClientCertificate handler ), i've tried to standardized the memory management but now, i can't find why the CefX509Certificate[] certificates param on java side public boolean onSelectClientCertificate(CefBrowser browser, boolean isProxy, String host, int port,
CefX509Certificate[] certificates, CefSelectClientCertificateCallback callback)

has the right dimension but the element inside is null

Perhaps could you help me ?

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

Re: implementation of OnSelectClientCertificate handler?

Postby magreenblatt » Fri Jan 31, 2020 12:53 pm

You need to call Release() instead of get() to return the jobject handle from NewJNIX509Certificate. Otherwise, it will be destroyed when ScopedJNICefX509Certificate goes out of scope.
magreenblatt
Site Admin
 
Posts: 9831
Joined: Fri May 29, 2009 6:57 pm

Re: implementation of OnSelectClientCertificate handler?

Postby darius » Fri Jan 31, 2020 5:45 pm

Great !!! Thank you very much ... the loop is full now. I'll remove some sysout, do some test and it will be ready for review
By the way, what's this api's (C++ part) way to log elements inside the console ?
darius
Techie
 
Posts: 16
Joined: Sun Jan 05, 2020 3:16 pm

PreviousNext

Return to JCEF Forum

Who is online

Users browsing this forum: No registered users and 2 guests