down votefavorite 
<http://stackoverflow.com/questions/34832602/android-play-https-video-with-certificate-private-key#>

I'm struggling for several days with an android issue, I cannot play videos 
from a HTTPS URL(hosted on digizuite.com if matters) using a Certificate 
and a Private Key:

I'm having a html with these videos embedded and I need either to play 
inside html or outside in a player.

The next source code I used in order to get the pages accesibile in 
WebView(so certificate it's ok) but I get error "html5: Video file not 
found"

Error log:

> 01-16 22:56:27.430 5829-6280/> E/cr_MediaResourceGetter: Error configuring 
> data source: setDataSource> failed: status = 0x80000000 01-16 22:56:27.430> 
> 5829-6280/ E/cr_MediaResourceGetter: Unable to> configure metadata extractor 
> 01-16 22:56:29.942> 5829-6320/e E/cr_MediaResourceGetter: Error> configuring 
> data source: setDataSource failed: status = 0x80000000> 01-16 22:56:29.942 
> 5829-6320/> E/cr_MediaResourceGetter: Unable to configure metadata extractor 
> 01-16> 22:56:30.001 5829-5829/ W/MediaPlayer: Couldn't
> open file on client side; trying server side:
> java.io.FileNotFoundException: No content provider:
> https://testname.digizuite.com/video.mp4
> 01-16 22:57:06.353 5829-5842/ E/MediaPlayer: error
> (1, -2147483648) 01-16 22:57:06.360 5829-5829/
> E/MediaPlayer: Error (1,-2147483648)

------------------------------

webView.setWebViewClient(new WebViewClient() {

                                     @Override
                                     public void 
onReceivedClientCertRequest(WebView view, ClientCertRequest handler) {
                                         try {
                                             AssetManager assetManager = 
getActivity().getAssets();
                                             InputStream inputStream = 
assetManager.open("test.pem");
                                             String caCert = 
IOUtil.readFully(inputStream);

                                             KeyStore store = 
SSLContextFactory.getInstance().getKeyStore(assetManager.open("certificate_test.p12"),
 "password", caCert);

                                             PrivateKey privateKey = null;
                                             X509Certificate[] certificates = 
null;
                                             Enumeration<String> e = 
store.aliases();
                                             for (; e.hasMoreElements(); ) {
                                                 String alias = e.nextElement();
                                                 if (store.isKeyEntry(alias)) {
                                                     KeyStore.PrivateKeyEntry 
entry = (KeyStore.PrivateKeyEntry) store.getEntry(alias, null);
                                                     privateKey = 
entry.getPrivateKey();
                                                     certificates = 
(X509Certificate[]) entry.getCertificateChain();
                                                 }
                                             }
                                             if (Build.VERSION.SDK_INT >= 
Build.VERSION_CODES.LOLLIPOP) {
                                                 handler.proceed(privateKey, 
certificates);
                                             }
                                         } catch (Exception e) {
                                             e.printStackTrace();
                                         }
                                     }
                                 }}

I have installed the certificate also on Device (Settings/Security) and in 
Chrome it's the same problem, pages are accesibile but videos can't be 
played.

I've installed Firefox and using a plugin "AddCertificate 1.0.10.01.1" the 
video was played ok.

I will prepare a cold beer for a good advice :D

-- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-developers/7c12ab57-2fa3-43d9-b42d-f2ca33a8eca8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to