Page 2 of 3

Re: implementation of OnSelectClientCertificate handler?

PostPosted: Fri Jan 24, 2020 4:45 am
by darius
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

Re: implementation of OnSelectClientCertificate handler?

PostPosted: Fri Jan 24, 2020 9:25 am
by magreenblatt
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.

Re: implementation of OnSelectClientCertificate handler?

PostPosted: Fri Jan 24, 2020 10:39 am
by darius
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)

Re: implementation of OnSelectClientCertificate handler?

PostPosted: Fri Jan 24, 2020 12:34 pm
by magreenblatt
Can you upload a PR with your changes so far?

Re: implementation of OnSelectClientCertificate handler?

PostPosted: Fri Jan 24, 2020 5:38 pm
by darius
Of course ... Here it is...commit 0dae895 (it's a draft )

Re: implementation of OnSelectClientCertificate handler?

PostPosted: Mon Jan 27, 2020 11:06 am
by darius
Ok ... it think i've got it .... I'm using now a ByteBuffer to keep the reference to the background CefX509Certificate.(commit 331132f)

Re: implementation of OnSelectClientCertificate handler?

PostPosted: Mon Jan 27, 2020 11:22 am
by magreenblatt
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().

Re: implementation of OnSelectClientCertificate handler?

PostPosted: Fri Jan 31, 2020 9:29 am
by darius
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

Re: implementation of OnSelectClientCertificate handler?

PostPosted: Fri Jan 31, 2020 12:53 pm
by magreenblatt
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.

Re: implementation of OnSelectClientCertificate handler?

PostPosted: Fri Jan 31, 2020 5:45 pm
by darius
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 ?