[jira] [Commented] (CB-12551) File-Transfer download/upload fails in Android 4.4 or older using TLS 1.2
[ https://issues.apache.org/jira/browse/CB-12551?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17187756#comment-17187756 ] Tim Brust commented on CB-12551: Closing, as we have ended support for Android API <22 in the meanwhile. > File-Transfer download/upload fails in Android 4.4 or older using TLS 1.2 > - > > Key: CB-12551 > URL: https://issues.apache.org/jira/browse/CB-12551 > Project: Apache Cordova > Issue Type: Bug > Components: cordova-plugin-file-transfer (DEPRECATED) >Reporter: Dani Palou >Priority: Major > > FileTransfer's download function fails when trying to download a file from a > site using TLS 1.2. This works fine in Android 5 or higher, but it fails in > Android 4.x. > I searched a bit and I found that Android 4.4 should support TLS1.2 but it is > disabled by default. I applied the solution proposed in this post and it > worked for me: > http://stackoverflow.com/a/33567745 > That is, I created the _MySSLSocketFactory_ class in the FileTransfer > project, and I used it in the _trustAllHosts_ function (line 636 of > _FileTransfer.java_): > {noformat} > SSLSocketFactory newFactory = new MySSLSocketFactory(sc.getSocketFactory()); > {noformat} > I'm not sure if this can cause problems with other certificates, I don't know > much about this. It would be nice if the Cordova team could take a look at > this and check if it can be solved. > This is the stacktrace: > {noformat} > Error getting HTTP status code from connection. > javax.net.ssl.SSLException: Connection closed by peer > at com.android.org.conscrypt.NativeCrypto.SSL_do_handshake(Native Method) > at > com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:405) > at com.android.okhttp.Connection.upgradeToTls(Connection.java:146) > at com.android.okhttp.Connection.connect(Connection.java:107) > at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:294) > at > com.android.okhttp.internal.http.HttpEngine.sendSocketRequest(HttpEngine.java:255) > at > com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:206) > at > com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:345) > at > com.android.okhttp.internal.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:89) > at > com.android.okhttp.internal.http.HttpsURLConnectionImpl.connect(HttpsURLConnectionImpl.java:161) > at org.apache.cordova.filetransfer.FileTransfer$4.run(FileTransfer.java:869) > at > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) > at > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) > at java.lang.Thread.run(Thread.java:841) > {noformat} > It can be tested with this code: > {noformat} > var ft = new FileTransfer(), > path = 'squirrel.jpg', > uri = > 'https://prototype.moodle.net/mobile/moodle32/webservice/pluginfile.php/314/mod_resource/content/3/squirrel.jpg?forcedownload=1=616455be9f363cc9631cab89cfcfa1cd'; > ft.download(uri, path, success, error, true); > function success() { > console.log('Success'); > } > function error(data) { > console.log('Error', data); > } > {noformat} -- This message was sent by Atlassian Jira (v8.3.4#803005) - To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org
[jira] [Commented] (CB-12551) File-Transfer download/upload fails in Android 4.4 or older using TLS 1.2
[ https://issues.apache.org/jira/browse/CB-12551?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16634638#comment-16634638 ] ASF GitHub Bot commented on CB-12551: - janpio commented on issue #197: CB-12551: (android) Patch Security Provider to support TLS 1.2 URL: https://github.com/apache/cordova-plugin-file-transfer/pull/197#issuecomment-426063702 I just submitted a fix to master, if you rebase on that your tests might pass (or at least fail less). This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > File-Transfer download/upload fails in Android 4.4 or older using TLS 1.2 > - > > Key: CB-12551 > URL: https://issues.apache.org/jira/browse/CB-12551 > Project: Apache Cordova > Issue Type: Bug > Components: cordova-plugin-file-transfer (DEPRECATED) >Reporter: Dani Palou >Priority: Major > > FileTransfer's download function fails when trying to download a file from a > site using TLS 1.2. This works fine in Android 5 or higher, but it fails in > Android 4.x. > I searched a bit and I found that Android 4.4 should support TLS1.2 but it is > disabled by default. I applied the solution proposed in this post and it > worked for me: > http://stackoverflow.com/a/33567745 > That is, I created the _MySSLSocketFactory_ class in the FileTransfer > project, and I used it in the _trustAllHosts_ function (line 636 of > _FileTransfer.java_): > {noformat} > SSLSocketFactory newFactory = new MySSLSocketFactory(sc.getSocketFactory()); > {noformat} > I'm not sure if this can cause problems with other certificates, I don't know > much about this. It would be nice if the Cordova team could take a look at > this and check if it can be solved. > This is the stacktrace: > {noformat} > Error getting HTTP status code from connection. > javax.net.ssl.SSLException: Connection closed by peer > at com.android.org.conscrypt.NativeCrypto.SSL_do_handshake(Native Method) > at > com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:405) > at com.android.okhttp.Connection.upgradeToTls(Connection.java:146) > at com.android.okhttp.Connection.connect(Connection.java:107) > at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:294) > at > com.android.okhttp.internal.http.HttpEngine.sendSocketRequest(HttpEngine.java:255) > at > com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:206) > at > com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:345) > at > com.android.okhttp.internal.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:89) > at > com.android.okhttp.internal.http.HttpsURLConnectionImpl.connect(HttpsURLConnectionImpl.java:161) > at org.apache.cordova.filetransfer.FileTransfer$4.run(FileTransfer.java:869) > at > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) > at > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) > at java.lang.Thread.run(Thread.java:841) > {noformat} > It can be tested with this code: > {noformat} > var ft = new FileTransfer(), > path = 'squirrel.jpg', > uri = > 'https://prototype.moodle.net/mobile/moodle32/webservice/pluginfile.php/314/mod_resource/content/3/squirrel.jpg?forcedownload=1=616455be9f363cc9631cab89cfcfa1cd'; > ft.download(uri, path, success, error, true); > function success() { > console.log('Success'); > } > function error(data) { > console.log('Error', data); > } > {noformat} -- This message was sent by Atlassian JIRA (v7.6.3#76005) - To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org
[jira] [Commented] (CB-12551) File-Transfer download/upload fails in Android 4.4 or older using TLS 1.2
[ https://issues.apache.org/jira/browse/CB-12551?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16606901#comment-16606901 ] ASF GitHub Bot commented on CB-12551: - janpio commented on issue #197: CB-12551: (android) Patch Security Provider to support TLS 1.2 URL: https://github.com/apache/cordova-plugin-file-transfer/pull/197#issuecomment-419384726 Not as long as there are failing tests probably. @davidofwatkins could you rebase on master? Might fix the test failures. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > File-Transfer download/upload fails in Android 4.4 or older using TLS 1.2 > - > > Key: CB-12551 > URL: https://issues.apache.org/jira/browse/CB-12551 > Project: Apache Cordova > Issue Type: Bug > Components: cordova-plugin-file-transfer (DEPRECATED) >Reporter: Dani Palou >Priority: Major > > FileTransfer's download function fails when trying to download a file from a > site using TLS 1.2. This works fine in Android 5 or higher, but it fails in > Android 4.x. > I searched a bit and I found that Android 4.4 should support TLS1.2 but it is > disabled by default. I applied the solution proposed in this post and it > worked for me: > http://stackoverflow.com/a/33567745 > That is, I created the _MySSLSocketFactory_ class in the FileTransfer > project, and I used it in the _trustAllHosts_ function (line 636 of > _FileTransfer.java_): > {noformat} > SSLSocketFactory newFactory = new MySSLSocketFactory(sc.getSocketFactory()); > {noformat} > I'm not sure if this can cause problems with other certificates, I don't know > much about this. It would be nice if the Cordova team could take a look at > this and check if it can be solved. > This is the stacktrace: > {noformat} > Error getting HTTP status code from connection. > javax.net.ssl.SSLException: Connection closed by peer > at com.android.org.conscrypt.NativeCrypto.SSL_do_handshake(Native Method) > at > com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:405) > at com.android.okhttp.Connection.upgradeToTls(Connection.java:146) > at com.android.okhttp.Connection.connect(Connection.java:107) > at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:294) > at > com.android.okhttp.internal.http.HttpEngine.sendSocketRequest(HttpEngine.java:255) > at > com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:206) > at > com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:345) > at > com.android.okhttp.internal.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:89) > at > com.android.okhttp.internal.http.HttpsURLConnectionImpl.connect(HttpsURLConnectionImpl.java:161) > at org.apache.cordova.filetransfer.FileTransfer$4.run(FileTransfer.java:869) > at > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) > at > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) > at java.lang.Thread.run(Thread.java:841) > {noformat} > It can be tested with this code: > {noformat} > var ft = new FileTransfer(), > path = 'squirrel.jpg', > uri = > 'https://prototype.moodle.net/mobile/moodle32/webservice/pluginfile.php/314/mod_resource/content/3/squirrel.jpg?forcedownload=1=616455be9f363cc9631cab89cfcfa1cd'; > ft.download(uri, path, success, error, true); > function success() { > console.log('Success'); > } > function error(data) { > console.log('Error', data); > } > {noformat} -- This message was sent by Atlassian JIRA (v7.6.3#76005) - To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org
[jira] [Commented] (CB-12551) File-Transfer download/upload fails in Android 4.4 or older using TLS 1.2
[ https://issues.apache.org/jira/browse/CB-12551?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16606716#comment-16606716 ] ASF GitHub Bot commented on CB-12551: - schotime commented on issue #197: CB-12551: (android) Patch Security Provider to support TLS 1.2 URL: https://github.com/apache/cordova-plugin-file-transfer/pull/197#issuecomment-419328353 Is this going to get merged? We need it too. Thx. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > File-Transfer download/upload fails in Android 4.4 or older using TLS 1.2 > - > > Key: CB-12551 > URL: https://issues.apache.org/jira/browse/CB-12551 > Project: Apache Cordova > Issue Type: Bug > Components: cordova-plugin-file-transfer (DEPRECATED) >Reporter: Dani Palou >Priority: Major > > FileTransfer's download function fails when trying to download a file from a > site using TLS 1.2. This works fine in Android 5 or higher, but it fails in > Android 4.x. > I searched a bit and I found that Android 4.4 should support TLS1.2 but it is > disabled by default. I applied the solution proposed in this post and it > worked for me: > http://stackoverflow.com/a/33567745 > That is, I created the _MySSLSocketFactory_ class in the FileTransfer > project, and I used it in the _trustAllHosts_ function (line 636 of > _FileTransfer.java_): > {noformat} > SSLSocketFactory newFactory = new MySSLSocketFactory(sc.getSocketFactory()); > {noformat} > I'm not sure if this can cause problems with other certificates, I don't know > much about this. It would be nice if the Cordova team could take a look at > this and check if it can be solved. > This is the stacktrace: > {noformat} > Error getting HTTP status code from connection. > javax.net.ssl.SSLException: Connection closed by peer > at com.android.org.conscrypt.NativeCrypto.SSL_do_handshake(Native Method) > at > com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:405) > at com.android.okhttp.Connection.upgradeToTls(Connection.java:146) > at com.android.okhttp.Connection.connect(Connection.java:107) > at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:294) > at > com.android.okhttp.internal.http.HttpEngine.sendSocketRequest(HttpEngine.java:255) > at > com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:206) > at > com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:345) > at > com.android.okhttp.internal.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:89) > at > com.android.okhttp.internal.http.HttpsURLConnectionImpl.connect(HttpsURLConnectionImpl.java:161) > at org.apache.cordova.filetransfer.FileTransfer$4.run(FileTransfer.java:869) > at > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) > at > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) > at java.lang.Thread.run(Thread.java:841) > {noformat} > It can be tested with this code: > {noformat} > var ft = new FileTransfer(), > path = 'squirrel.jpg', > uri = > 'https://prototype.moodle.net/mobile/moodle32/webservice/pluginfile.php/314/mod_resource/content/3/squirrel.jpg?forcedownload=1=616455be9f363cc9631cab89cfcfa1cd'; > ft.download(uri, path, success, error, true); > function success() { > console.log('Success'); > } > function error(data) { > console.log('Error', data); > } > {noformat} -- This message was sent by Atlassian JIRA (v7.6.3#76005) - To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org
[jira] [Commented] (CB-12551) File-Transfer download/upload fails in Android 4.4 or older using TLS 1.2
[ https://issues.apache.org/jira/browse/CB-12551?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16506439#comment-16506439 ] ASF GitHub Bot commented on CB-12551: - davidofwatkins commented on a change in pull request #197: CB-12551: (android) Patch Security Provider to support TLS 1.2 URL: https://github.com/apache/cordova-plugin-file-transfer/pull/197#discussion_r194149186 ## File path: plugin.xml ## @@ -54,6 +54,8 @@ + + Review comment: Ah, I wasn't aware of this. Good to know, thanks! This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > File-Transfer download/upload fails in Android 4.4 or older using TLS 1.2 > - > > Key: CB-12551 > URL: https://issues.apache.org/jira/browse/CB-12551 > Project: Apache Cordova > Issue Type: Bug > Components: cordova-plugin-file-transfer (DEPRECATED) >Reporter: Dani Palou >Priority: Major > > FileTransfer's download function fails when trying to download a file from a > site using TLS 1.2. This works fine in Android 5 or higher, but it fails in > Android 4.x. > I searched a bit and I found that Android 4.4 should support TLS1.2 but it is > disabled by default. I applied the solution proposed in this post and it > worked for me: > http://stackoverflow.com/a/33567745 > That is, I created the _MySSLSocketFactory_ class in the FileTransfer > project, and I used it in the _trustAllHosts_ function (line 636 of > _FileTransfer.java_): > {noformat} > SSLSocketFactory newFactory = new MySSLSocketFactory(sc.getSocketFactory()); > {noformat} > I'm not sure if this can cause problems with other certificates, I don't know > much about this. It would be nice if the Cordova team could take a look at > this and check if it can be solved. > This is the stacktrace: > {noformat} > Error getting HTTP status code from connection. > javax.net.ssl.SSLException: Connection closed by peer > at com.android.org.conscrypt.NativeCrypto.SSL_do_handshake(Native Method) > at > com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:405) > at com.android.okhttp.Connection.upgradeToTls(Connection.java:146) > at com.android.okhttp.Connection.connect(Connection.java:107) > at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:294) > at > com.android.okhttp.internal.http.HttpEngine.sendSocketRequest(HttpEngine.java:255) > at > com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:206) > at > com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:345) > at > com.android.okhttp.internal.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:89) > at > com.android.okhttp.internal.http.HttpsURLConnectionImpl.connect(HttpsURLConnectionImpl.java:161) > at org.apache.cordova.filetransfer.FileTransfer$4.run(FileTransfer.java:869) > at > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) > at > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) > at java.lang.Thread.run(Thread.java:841) > {noformat} > It can be tested with this code: > {noformat} > var ft = new FileTransfer(), > path = 'squirrel.jpg', > uri = > 'https://prototype.moodle.net/mobile/moodle32/webservice/pluginfile.php/314/mod_resource/content/3/squirrel.jpg?forcedownload=1=616455be9f363cc9631cab89cfcfa1cd'; > ft.download(uri, path, success, error, true); > function success() { > console.log('Success'); > } > function error(data) { > console.log('Error', data); > } > {noformat} -- This message was sent by Atlassian JIRA (v7.6.3#76005) - To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org
[jira] [Commented] (CB-12551) File-Transfer download/upload fails in Android 4.4 or older using TLS 1.2
[ https://issues.apache.org/jira/browse/CB-12551?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16506440#comment-16506440 ] ASF GitHub Bot commented on CB-12551: - davidofwatkins commented on issue #197: CB-12551: (android) Patch Security Provider to support TLS 1.2 URL: https://github.com/apache/cordova-plugin-file-transfer/pull/197#issuecomment-395853380 @macdonst Done, feedback addressed Thanks! This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > File-Transfer download/upload fails in Android 4.4 or older using TLS 1.2 > - > > Key: CB-12551 > URL: https://issues.apache.org/jira/browse/CB-12551 > Project: Apache Cordova > Issue Type: Bug > Components: cordova-plugin-file-transfer (DEPRECATED) >Reporter: Dani Palou >Priority: Major > > FileTransfer's download function fails when trying to download a file from a > site using TLS 1.2. This works fine in Android 5 or higher, but it fails in > Android 4.x. > I searched a bit and I found that Android 4.4 should support TLS1.2 but it is > disabled by default. I applied the solution proposed in this post and it > worked for me: > http://stackoverflow.com/a/33567745 > That is, I created the _MySSLSocketFactory_ class in the FileTransfer > project, and I used it in the _trustAllHosts_ function (line 636 of > _FileTransfer.java_): > {noformat} > SSLSocketFactory newFactory = new MySSLSocketFactory(sc.getSocketFactory()); > {noformat} > I'm not sure if this can cause problems with other certificates, I don't know > much about this. It would be nice if the Cordova team could take a look at > this and check if it can be solved. > This is the stacktrace: > {noformat} > Error getting HTTP status code from connection. > javax.net.ssl.SSLException: Connection closed by peer > at com.android.org.conscrypt.NativeCrypto.SSL_do_handshake(Native Method) > at > com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:405) > at com.android.okhttp.Connection.upgradeToTls(Connection.java:146) > at com.android.okhttp.Connection.connect(Connection.java:107) > at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:294) > at > com.android.okhttp.internal.http.HttpEngine.sendSocketRequest(HttpEngine.java:255) > at > com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:206) > at > com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:345) > at > com.android.okhttp.internal.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:89) > at > com.android.okhttp.internal.http.HttpsURLConnectionImpl.connect(HttpsURLConnectionImpl.java:161) > at org.apache.cordova.filetransfer.FileTransfer$4.run(FileTransfer.java:869) > at > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) > at > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) > at java.lang.Thread.run(Thread.java:841) > {noformat} > It can be tested with this code: > {noformat} > var ft = new FileTransfer(), > path = 'squirrel.jpg', > uri = > 'https://prototype.moodle.net/mobile/moodle32/webservice/pluginfile.php/314/mod_resource/content/3/squirrel.jpg?forcedownload=1=616455be9f363cc9631cab89cfcfa1cd'; > ft.download(uri, path, success, error, true); > function success() { > console.log('Success'); > } > function error(data) { > console.log('Error', data); > } > {noformat} -- This message was sent by Atlassian JIRA (v7.6.3#76005) - To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org
[jira] [Commented] (CB-12551) File-Transfer download/upload fails in Android 4.4 or older using TLS 1.2
[ https://issues.apache.org/jira/browse/CB-12551?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16505569#comment-16505569 ] ASF GitHub Bot commented on CB-12551: - macdonst commented on a change in pull request #197: CB-12551: (android) Patch Security Provider to support TLS 1.2 URL: https://github.com/apache/cordova-plugin-file-transfer/pull/197#discussion_r193927829 ## File path: plugin.xml ## @@ -54,6 +54,8 @@ + + Review comment: @davidofwatkins can you make this line: ``` ``` and also add in an engine tag: ``` ``` This gets around the Play Services issue: https://blog.phonegap.com/the-play-services-problem-with-cordova-applications-489c9aeb2e89 This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > File-Transfer download/upload fails in Android 4.4 or older using TLS 1.2 > - > > Key: CB-12551 > URL: https://issues.apache.org/jira/browse/CB-12551 > Project: Apache Cordova > Issue Type: Bug > Components: cordova-plugin-file-transfer (DEPRECATED) >Reporter: Dani Palou >Priority: Major > > FileTransfer's download function fails when trying to download a file from a > site using TLS 1.2. This works fine in Android 5 or higher, but it fails in > Android 4.x. > I searched a bit and I found that Android 4.4 should support TLS1.2 but it is > disabled by default. I applied the solution proposed in this post and it > worked for me: > http://stackoverflow.com/a/33567745 > That is, I created the _MySSLSocketFactory_ class in the FileTransfer > project, and I used it in the _trustAllHosts_ function (line 636 of > _FileTransfer.java_): > {noformat} > SSLSocketFactory newFactory = new MySSLSocketFactory(sc.getSocketFactory()); > {noformat} > I'm not sure if this can cause problems with other certificates, I don't know > much about this. It would be nice if the Cordova team could take a look at > this and check if it can be solved. > This is the stacktrace: > {noformat} > Error getting HTTP status code from connection. > javax.net.ssl.SSLException: Connection closed by peer > at com.android.org.conscrypt.NativeCrypto.SSL_do_handshake(Native Method) > at > com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:405) > at com.android.okhttp.Connection.upgradeToTls(Connection.java:146) > at com.android.okhttp.Connection.connect(Connection.java:107) > at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:294) > at > com.android.okhttp.internal.http.HttpEngine.sendSocketRequest(HttpEngine.java:255) > at > com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:206) > at > com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:345) > at > com.android.okhttp.internal.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:89) > at > com.android.okhttp.internal.http.HttpsURLConnectionImpl.connect(HttpsURLConnectionImpl.java:161) > at org.apache.cordova.filetransfer.FileTransfer$4.run(FileTransfer.java:869) > at > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) > at > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) > at java.lang.Thread.run(Thread.java:841) > {noformat} > It can be tested with this code: > {noformat} > var ft = new FileTransfer(), > path = 'squirrel.jpg', > uri = > 'https://prototype.moodle.net/mobile/moodle32/webservice/pluginfile.php/314/mod_resource/content/3/squirrel.jpg?forcedownload=1=616455be9f363cc9631cab89cfcfa1cd'; > ft.download(uri, path, success, error, true); > function success() { > console.log('Success'); > } > function error(data) { > console.log('Error', data); > } > {noformat} -- This message was sent by Atlassian JIRA (v7.6.3#76005) - To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org
[jira] [Commented] (CB-12551) File-Transfer download/upload fails in Android 4.4 or older using TLS 1.2
[ https://issues.apache.org/jira/browse/CB-12551?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16505571#comment-16505571 ] ASF GitHub Bot commented on CB-12551: - macdonst commented on issue #197: CB-12551: (android) Patch Security Provider to support TLS 1.2 URL: https://github.com/apache/cordova-plugin-file-transfer/pull/197#issuecomment-395611577 @davidofwatkins sorry, one more comment I forgot earlier. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > File-Transfer download/upload fails in Android 4.4 or older using TLS 1.2 > - > > Key: CB-12551 > URL: https://issues.apache.org/jira/browse/CB-12551 > Project: Apache Cordova > Issue Type: Bug > Components: cordova-plugin-file-transfer (DEPRECATED) >Reporter: Dani Palou >Priority: Major > > FileTransfer's download function fails when trying to download a file from a > site using TLS 1.2. This works fine in Android 5 or higher, but it fails in > Android 4.x. > I searched a bit and I found that Android 4.4 should support TLS1.2 but it is > disabled by default. I applied the solution proposed in this post and it > worked for me: > http://stackoverflow.com/a/33567745 > That is, I created the _MySSLSocketFactory_ class in the FileTransfer > project, and I used it in the _trustAllHosts_ function (line 636 of > _FileTransfer.java_): > {noformat} > SSLSocketFactory newFactory = new MySSLSocketFactory(sc.getSocketFactory()); > {noformat} > I'm not sure if this can cause problems with other certificates, I don't know > much about this. It would be nice if the Cordova team could take a look at > this and check if it can be solved. > This is the stacktrace: > {noformat} > Error getting HTTP status code from connection. > javax.net.ssl.SSLException: Connection closed by peer > at com.android.org.conscrypt.NativeCrypto.SSL_do_handshake(Native Method) > at > com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:405) > at com.android.okhttp.Connection.upgradeToTls(Connection.java:146) > at com.android.okhttp.Connection.connect(Connection.java:107) > at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:294) > at > com.android.okhttp.internal.http.HttpEngine.sendSocketRequest(HttpEngine.java:255) > at > com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:206) > at > com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:345) > at > com.android.okhttp.internal.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:89) > at > com.android.okhttp.internal.http.HttpsURLConnectionImpl.connect(HttpsURLConnectionImpl.java:161) > at org.apache.cordova.filetransfer.FileTransfer$4.run(FileTransfer.java:869) > at > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) > at > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) > at java.lang.Thread.run(Thread.java:841) > {noformat} > It can be tested with this code: > {noformat} > var ft = new FileTransfer(), > path = 'squirrel.jpg', > uri = > 'https://prototype.moodle.net/mobile/moodle32/webservice/pluginfile.php/314/mod_resource/content/3/squirrel.jpg?forcedownload=1=616455be9f363cc9631cab89cfcfa1cd'; > ft.download(uri, path, success, error, true); > function success() { > console.log('Success'); > } > function error(data) { > console.log('Error', data); > } > {noformat} -- This message was sent by Atlassian JIRA (v7.6.3#76005) - To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org
[jira] [Commented] (CB-12551) File-Transfer download/upload fails in Android 4.4 or older using TLS 1.2
[ https://issues.apache.org/jira/browse/CB-12551?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16505275#comment-16505275 ] ASF GitHub Bot commented on CB-12551: - davidofwatkins commented on a change in pull request #197: CB-12551: (android) Patch Security Provider to support TLS 1.2 URL: https://github.com/apache/cordova-plugin-file-transfer/pull/197#discussion_r193888502 ## File path: src/android/FileTransfer.java ## @@ -53,8 +53,13 @@ Licensed to the Apache Software Foundation (ASF) under one import android.net.Uri; import android.os.Build; +import android.util.Log; import android.webkit.CookieManager; +import com.google.android.gms.common.GooglePlayServicesNotAvailableException; Review comment: Good catch! Yep, I forgot to include that here. Added! This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > File-Transfer download/upload fails in Android 4.4 or older using TLS 1.2 > - > > Key: CB-12551 > URL: https://issues.apache.org/jira/browse/CB-12551 > Project: Apache Cordova > Issue Type: Bug > Components: cordova-plugin-file-transfer (DEPRECATED) >Reporter: Dani Palou >Priority: Major > > FileTransfer's download function fails when trying to download a file from a > site using TLS 1.2. This works fine in Android 5 or higher, but it fails in > Android 4.x. > I searched a bit and I found that Android 4.4 should support TLS1.2 but it is > disabled by default. I applied the solution proposed in this post and it > worked for me: > http://stackoverflow.com/a/33567745 > That is, I created the _MySSLSocketFactory_ class in the FileTransfer > project, and I used it in the _trustAllHosts_ function (line 636 of > _FileTransfer.java_): > {noformat} > SSLSocketFactory newFactory = new MySSLSocketFactory(sc.getSocketFactory()); > {noformat} > I'm not sure if this can cause problems with other certificates, I don't know > much about this. It would be nice if the Cordova team could take a look at > this and check if it can be solved. > This is the stacktrace: > {noformat} > Error getting HTTP status code from connection. > javax.net.ssl.SSLException: Connection closed by peer > at com.android.org.conscrypt.NativeCrypto.SSL_do_handshake(Native Method) > at > com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:405) > at com.android.okhttp.Connection.upgradeToTls(Connection.java:146) > at com.android.okhttp.Connection.connect(Connection.java:107) > at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:294) > at > com.android.okhttp.internal.http.HttpEngine.sendSocketRequest(HttpEngine.java:255) > at > com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:206) > at > com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:345) > at > com.android.okhttp.internal.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:89) > at > com.android.okhttp.internal.http.HttpsURLConnectionImpl.connect(HttpsURLConnectionImpl.java:161) > at org.apache.cordova.filetransfer.FileTransfer$4.run(FileTransfer.java:869) > at > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) > at > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) > at java.lang.Thread.run(Thread.java:841) > {noformat} > It can be tested with this code: > {noformat} > var ft = new FileTransfer(), > path = 'squirrel.jpg', > uri = > 'https://prototype.moodle.net/mobile/moodle32/webservice/pluginfile.php/314/mod_resource/content/3/squirrel.jpg?forcedownload=1=616455be9f363cc9631cab89cfcfa1cd'; > ft.download(uri, path, success, error, true); > function success() { > console.log('Success'); > } > function error(data) { > console.log('Error', data); > } > {noformat} -- This message was sent by Atlassian JIRA (v7.6.3#76005) - To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org
[jira] [Commented] (CB-12551) File-Transfer download/upload fails in Android 4.4 or older using TLS 1.2
[ https://issues.apache.org/jira/browse/CB-12551?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16505276#comment-16505276 ] ASF GitHub Bot commented on CB-12551: - davidofwatkins commented on issue #197: CB-12551: (android) Patch Security Provider to support TLS 1.2 URL: https://github.com/apache/cordova-plugin-file-transfer/pull/197#issuecomment-395564285 @almas Thanks for the review! Feedback is addressed. Please let me know if you spot anything else :) This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > File-Transfer download/upload fails in Android 4.4 or older using TLS 1.2 > - > > Key: CB-12551 > URL: https://issues.apache.org/jira/browse/CB-12551 > Project: Apache Cordova > Issue Type: Bug > Components: cordova-plugin-file-transfer (DEPRECATED) >Reporter: Dani Palou >Priority: Major > > FileTransfer's download function fails when trying to download a file from a > site using TLS 1.2. This works fine in Android 5 or higher, but it fails in > Android 4.x. > I searched a bit and I found that Android 4.4 should support TLS1.2 but it is > disabled by default. I applied the solution proposed in this post and it > worked for me: > http://stackoverflow.com/a/33567745 > That is, I created the _MySSLSocketFactory_ class in the FileTransfer > project, and I used it in the _trustAllHosts_ function (line 636 of > _FileTransfer.java_): > {noformat} > SSLSocketFactory newFactory = new MySSLSocketFactory(sc.getSocketFactory()); > {noformat} > I'm not sure if this can cause problems with other certificates, I don't know > much about this. It would be nice if the Cordova team could take a look at > this and check if it can be solved. > This is the stacktrace: > {noformat} > Error getting HTTP status code from connection. > javax.net.ssl.SSLException: Connection closed by peer > at com.android.org.conscrypt.NativeCrypto.SSL_do_handshake(Native Method) > at > com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:405) > at com.android.okhttp.Connection.upgradeToTls(Connection.java:146) > at com.android.okhttp.Connection.connect(Connection.java:107) > at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:294) > at > com.android.okhttp.internal.http.HttpEngine.sendSocketRequest(HttpEngine.java:255) > at > com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:206) > at > com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:345) > at > com.android.okhttp.internal.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:89) > at > com.android.okhttp.internal.http.HttpsURLConnectionImpl.connect(HttpsURLConnectionImpl.java:161) > at org.apache.cordova.filetransfer.FileTransfer$4.run(FileTransfer.java:869) > at > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) > at > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) > at java.lang.Thread.run(Thread.java:841) > {noformat} > It can be tested with this code: > {noformat} > var ft = new FileTransfer(), > path = 'squirrel.jpg', > uri = > 'https://prototype.moodle.net/mobile/moodle32/webservice/pluginfile.php/314/mod_resource/content/3/squirrel.jpg?forcedownload=1=616455be9f363cc9631cab89cfcfa1cd'; > ft.download(uri, path, success, error, true); > function success() { > console.log('Success'); > } > function error(data) { > console.log('Error', data); > } > {noformat} -- This message was sent by Atlassian JIRA (v7.6.3#76005) - To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org
[jira] [Commented] (CB-12551) File-Transfer download/upload fails in Android 4.4 or older using TLS 1.2
[ https://issues.apache.org/jira/browse/CB-12551?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16504598#comment-16504598 ] ASF GitHub Bot commented on CB-12551: - macdonst commented on a change in pull request #197: CB-12551: (android) Patch Security Provider to support TLS 1.2 URL: https://github.com/apache/cordova-plugin-file-transfer/pull/197#discussion_r193724088 ## File path: src/android/FileTransfer.java ## @@ -53,8 +53,13 @@ Licensed to the Apache Software Foundation (ASF) under one import android.net.Uri; import android.os.Build; +import android.util.Log; Review comment: @davidofwatkins use `org.apache.cordova.LOG` instead. It has the same method signature as `android.util.Log` and it fixes an issue where `android.util.Log` doesn't get stripped properly from binaries. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > File-Transfer download/upload fails in Android 4.4 or older using TLS 1.2 > - > > Key: CB-12551 > URL: https://issues.apache.org/jira/browse/CB-12551 > Project: Apache Cordova > Issue Type: Bug > Components: cordova-plugin-file-transfer (DEPRECATED) >Reporter: Dani Palou >Priority: Major > > FileTransfer's download function fails when trying to download a file from a > site using TLS 1.2. This works fine in Android 5 or higher, but it fails in > Android 4.x. > I searched a bit and I found that Android 4.4 should support TLS1.2 but it is > disabled by default. I applied the solution proposed in this post and it > worked for me: > http://stackoverflow.com/a/33567745 > That is, I created the _MySSLSocketFactory_ class in the FileTransfer > project, and I used it in the _trustAllHosts_ function (line 636 of > _FileTransfer.java_): > {noformat} > SSLSocketFactory newFactory = new MySSLSocketFactory(sc.getSocketFactory()); > {noformat} > I'm not sure if this can cause problems with other certificates, I don't know > much about this. It would be nice if the Cordova team could take a look at > this and check if it can be solved. > This is the stacktrace: > {noformat} > Error getting HTTP status code from connection. > javax.net.ssl.SSLException: Connection closed by peer > at com.android.org.conscrypt.NativeCrypto.SSL_do_handshake(Native Method) > at > com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:405) > at com.android.okhttp.Connection.upgradeToTls(Connection.java:146) > at com.android.okhttp.Connection.connect(Connection.java:107) > at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:294) > at > com.android.okhttp.internal.http.HttpEngine.sendSocketRequest(HttpEngine.java:255) > at > com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:206) > at > com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:345) > at > com.android.okhttp.internal.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:89) > at > com.android.okhttp.internal.http.HttpsURLConnectionImpl.connect(HttpsURLConnectionImpl.java:161) > at org.apache.cordova.filetransfer.FileTransfer$4.run(FileTransfer.java:869) > at > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) > at > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) > at java.lang.Thread.run(Thread.java:841) > {noformat} > It can be tested with this code: > {noformat} > var ft = new FileTransfer(), > path = 'squirrel.jpg', > uri = > 'https://prototype.moodle.net/mobile/moodle32/webservice/pluginfile.php/314/mod_resource/content/3/squirrel.jpg?forcedownload=1=616455be9f363cc9631cab89cfcfa1cd'; > ft.download(uri, path, success, error, true); > function success() { > console.log('Success'); > } > function error(data) { > console.log('Error', data); > } > {noformat} -- This message was sent by Atlassian JIRA (v7.6.3#76005) - To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org
[jira] [Commented] (CB-12551) File-Transfer download/upload fails in Android 4.4 or older using TLS 1.2
[ https://issues.apache.org/jira/browse/CB-12551?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16504600#comment-16504600 ] ASF GitHub Bot commented on CB-12551: - macdonst commented on a change in pull request #197: CB-12551: (android) Patch Security Provider to support TLS 1.2 URL: https://github.com/apache/cordova-plugin-file-transfer/pull/197#discussion_r193726833 ## File path: src/android/FileTransfer.java ## @@ -53,8 +53,13 @@ Licensed to the Apache Software Foundation (ASF) under one import android.net.Uri; import android.os.Build; +import android.util.Log; import android.webkit.CookieManager; +import com.google.android.gms.common.GooglePlayServicesNotAvailableException; Review comment: @davidofwatkins Don't you need to add Play Services as a `framework` tag in the `plugin.xml` file in order for this to compile? This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > File-Transfer download/upload fails in Android 4.4 or older using TLS 1.2 > - > > Key: CB-12551 > URL: https://issues.apache.org/jira/browse/CB-12551 > Project: Apache Cordova > Issue Type: Bug > Components: cordova-plugin-file-transfer (DEPRECATED) >Reporter: Dani Palou >Priority: Major > > FileTransfer's download function fails when trying to download a file from a > site using TLS 1.2. This works fine in Android 5 or higher, but it fails in > Android 4.x. > I searched a bit and I found that Android 4.4 should support TLS1.2 but it is > disabled by default. I applied the solution proposed in this post and it > worked for me: > http://stackoverflow.com/a/33567745 > That is, I created the _MySSLSocketFactory_ class in the FileTransfer > project, and I used it in the _trustAllHosts_ function (line 636 of > _FileTransfer.java_): > {noformat} > SSLSocketFactory newFactory = new MySSLSocketFactory(sc.getSocketFactory()); > {noformat} > I'm not sure if this can cause problems with other certificates, I don't know > much about this. It would be nice if the Cordova team could take a look at > this and check if it can be solved. > This is the stacktrace: > {noformat} > Error getting HTTP status code from connection. > javax.net.ssl.SSLException: Connection closed by peer > at com.android.org.conscrypt.NativeCrypto.SSL_do_handshake(Native Method) > at > com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:405) > at com.android.okhttp.Connection.upgradeToTls(Connection.java:146) > at com.android.okhttp.Connection.connect(Connection.java:107) > at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:294) > at > com.android.okhttp.internal.http.HttpEngine.sendSocketRequest(HttpEngine.java:255) > at > com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:206) > at > com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:345) > at > com.android.okhttp.internal.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:89) > at > com.android.okhttp.internal.http.HttpsURLConnectionImpl.connect(HttpsURLConnectionImpl.java:161) > at org.apache.cordova.filetransfer.FileTransfer$4.run(FileTransfer.java:869) > at > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) > at > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) > at java.lang.Thread.run(Thread.java:841) > {noformat} > It can be tested with this code: > {noformat} > var ft = new FileTransfer(), > path = 'squirrel.jpg', > uri = > 'https://prototype.moodle.net/mobile/moodle32/webservice/pluginfile.php/314/mod_resource/content/3/squirrel.jpg?forcedownload=1=616455be9f363cc9631cab89cfcfa1cd'; > ft.download(uri, path, success, error, true); > function success() { > console.log('Success'); > } > function error(data) { > console.log('Error', data); > } > {noformat} -- This message was sent by Atlassian JIRA (v7.6.3#76005) - To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org
[jira] [Commented] (CB-12551) File-Transfer download/upload fails in Android 4.4 or older using TLS 1.2
[ https://issues.apache.org/jira/browse/CB-12551?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16504599#comment-16504599 ] ASF GitHub Bot commented on CB-12551: - macdonst commented on a change in pull request #197: CB-12551: (android) Patch Security Provider to support TLS 1.2 URL: https://github.com/apache/cordova-plugin-file-transfer/pull/197#discussion_r193725018 ## File path: src/android/FileTransfer.java ## @@ -168,6 +173,17 @@ public boolean execute(String action, JSONArray args, final CallbackContext call String source = args.getString(0); String target = args.getString(1); +// Patch the Security Provider via Google Play Services to improve support for newer TLS/SSL standards in +// older versions of Android (@jira:CB-12551). More info here: +// https://developer.android.com/training/articles/security-gms-provider.html +try { + ProviderInstaller.installIfNeeded(this.cordova.getActivity().getApplicationContext()); +} catch (GooglePlayServicesRepairableException e) { +Log.e(LOG_TAG, "Google Play Services is out of date. Unable to patch security provider"); Review comment: @davidofwatkins besides logging the error we should probably tell the user to update Play Services. Failing silently doesn't really help. ``` // Prompt the user to install/update/enable Google Play services. GoogleApiAvailability.getInstance() .showErrorNotification(context, e.connectionStatusCode) ``` This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > File-Transfer download/upload fails in Android 4.4 or older using TLS 1.2 > - > > Key: CB-12551 > URL: https://issues.apache.org/jira/browse/CB-12551 > Project: Apache Cordova > Issue Type: Bug > Components: cordova-plugin-file-transfer (DEPRECATED) >Reporter: Dani Palou >Priority: Major > > FileTransfer's download function fails when trying to download a file from a > site using TLS 1.2. This works fine in Android 5 or higher, but it fails in > Android 4.x. > I searched a bit and I found that Android 4.4 should support TLS1.2 but it is > disabled by default. I applied the solution proposed in this post and it > worked for me: > http://stackoverflow.com/a/33567745 > That is, I created the _MySSLSocketFactory_ class in the FileTransfer > project, and I used it in the _trustAllHosts_ function (line 636 of > _FileTransfer.java_): > {noformat} > SSLSocketFactory newFactory = new MySSLSocketFactory(sc.getSocketFactory()); > {noformat} > I'm not sure if this can cause problems with other certificates, I don't know > much about this. It would be nice if the Cordova team could take a look at > this and check if it can be solved. > This is the stacktrace: > {noformat} > Error getting HTTP status code from connection. > javax.net.ssl.SSLException: Connection closed by peer > at com.android.org.conscrypt.NativeCrypto.SSL_do_handshake(Native Method) > at > com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:405) > at com.android.okhttp.Connection.upgradeToTls(Connection.java:146) > at com.android.okhttp.Connection.connect(Connection.java:107) > at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:294) > at > com.android.okhttp.internal.http.HttpEngine.sendSocketRequest(HttpEngine.java:255) > at > com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:206) > at > com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:345) > at > com.android.okhttp.internal.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:89) > at > com.android.okhttp.internal.http.HttpsURLConnectionImpl.connect(HttpsURLConnectionImpl.java:161) > at org.apache.cordova.filetransfer.FileTransfer$4.run(FileTransfer.java:869) > at > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) > at > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) > at java.lang.Thread.run(Thread.java:841) > {noformat} > It can be tested with this code: > {noformat} > var ft = new FileTransfer(), > path = 'squirrel.jpg', > uri = > 'https://prototype.moodle.net/mobile/moodle32/webservice/pluginfile.php/314/mod_resource/content/3/squirrel.jpg?forcedownload=1=616455be9f363cc9631cab89cfcfa1cd'; > ft.download(uri, path, success, error, true); > function success() { >
[jira] [Commented] (CB-12551) File-Transfer download/upload fails in Android 4.4 or older using TLS 1.2
[ https://issues.apache.org/jira/browse/CB-12551?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16504543#comment-16504543 ] ASF GitHub Bot commented on CB-12551: - almas commented on issue #197: CB-12551: (android) Patch Security Provider to support TLS 1.2 URL: https://github.com/apache/cordova-plugin-file-transfer/pull/197#issuecomment-395385751 I need this one. Please merge it. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > File-Transfer download/upload fails in Android 4.4 or older using TLS 1.2 > - > > Key: CB-12551 > URL: https://issues.apache.org/jira/browse/CB-12551 > Project: Apache Cordova > Issue Type: Bug > Components: cordova-plugin-file-transfer (DEPRECATED) >Reporter: Dani Palou >Priority: Major > > FileTransfer's download function fails when trying to download a file from a > site using TLS 1.2. This works fine in Android 5 or higher, but it fails in > Android 4.x. > I searched a bit and I found that Android 4.4 should support TLS1.2 but it is > disabled by default. I applied the solution proposed in this post and it > worked for me: > http://stackoverflow.com/a/33567745 > That is, I created the _MySSLSocketFactory_ class in the FileTransfer > project, and I used it in the _trustAllHosts_ function (line 636 of > _FileTransfer.java_): > {noformat} > SSLSocketFactory newFactory = new MySSLSocketFactory(sc.getSocketFactory()); > {noformat} > I'm not sure if this can cause problems with other certificates, I don't know > much about this. It would be nice if the Cordova team could take a look at > this and check if it can be solved. > This is the stacktrace: > {noformat} > Error getting HTTP status code from connection. > javax.net.ssl.SSLException: Connection closed by peer > at com.android.org.conscrypt.NativeCrypto.SSL_do_handshake(Native Method) > at > com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:405) > at com.android.okhttp.Connection.upgradeToTls(Connection.java:146) > at com.android.okhttp.Connection.connect(Connection.java:107) > at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:294) > at > com.android.okhttp.internal.http.HttpEngine.sendSocketRequest(HttpEngine.java:255) > at > com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:206) > at > com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:345) > at > com.android.okhttp.internal.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:89) > at > com.android.okhttp.internal.http.HttpsURLConnectionImpl.connect(HttpsURLConnectionImpl.java:161) > at org.apache.cordova.filetransfer.FileTransfer$4.run(FileTransfer.java:869) > at > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) > at > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) > at java.lang.Thread.run(Thread.java:841) > {noformat} > It can be tested with this code: > {noformat} > var ft = new FileTransfer(), > path = 'squirrel.jpg', > uri = > 'https://prototype.moodle.net/mobile/moodle32/webservice/pluginfile.php/314/mod_resource/content/3/squirrel.jpg?forcedownload=1=616455be9f363cc9631cab89cfcfa1cd'; > ft.download(uri, path, success, error, true); > function success() { > console.log('Success'); > } > function error(data) { > console.log('Error', data); > } > {noformat} -- This message was sent by Atlassian JIRA (v7.6.3#76005) - To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org
[jira] [Commented] (CB-12551) File-Transfer download/upload fails in Android 4.4 or older using TLS 1.2
[ https://issues.apache.org/jira/browse/CB-12551?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16421964#comment-16421964 ] ASF GitHub Bot commented on CB-12551: - davidofwatkins opened a new pull request #197: CB-12551: (android) Patch Security Provider to support TLS 1.2 URL: https://github.com/apache/cordova-plugin-file-transfer/pull/197 ### Platforms affected Android 4.4 and below (API level 16-20) ### What does this PR do? Adds support for newer versions of TLS (v1.2) to older versions of Android (API level 16+) by patching the Security Provider with ProviderInstaller as per the documentation here: https://developer.android.com/training/articles/security-gms-provider.html ### What testing has been done on this change? I've only been able to test Android 4.4.x, but this should work on Android API levels 16+. ### Checklist - [x] [Reported an issue](http://cordova.apache.org/contribute/issues.html) in the JIRA database - Issue already exists: https://issues.apache.org/jira/browse/CB-12551 - [x] Commit message follows the format: "CB-3232: (android) Fix bug with resolving file paths", where CB- is the JIRA ID & "android" is the platform affected. - [ ] Added automated test coverage as appropriate for this change. - N/A This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > File-Transfer download/upload fails in Android 4.4 or older using TLS 1.2 > - > > Key: CB-12551 > URL: https://issues.apache.org/jira/browse/CB-12551 > Project: Apache Cordova > Issue Type: Bug > Components: cordova-plugin-file-transfer (DEPRECATED) >Reporter: Dani Palou >Priority: Major > > FileTransfer's download function fails when trying to download a file from a > site using TLS 1.2. This works fine in Android 5 or higher, but it fails in > Android 4.x. > I searched a bit and I found that Android 4.4 should support TLS1.2 but it is > disabled by default. I applied the solution proposed in this post and it > worked for me: > http://stackoverflow.com/a/33567745 > That is, I created the _MySSLSocketFactory_ class in the FileTransfer > project, and I used it in the _trustAllHosts_ function (line 636 of > _FileTransfer.java_): > {noformat} > SSLSocketFactory newFactory = new MySSLSocketFactory(sc.getSocketFactory()); > {noformat} > I'm not sure if this can cause problems with other certificates, I don't know > much about this. It would be nice if the Cordova team could take a look at > this and check if it can be solved. > This is the stacktrace: > {noformat} > Error getting HTTP status code from connection. > javax.net.ssl.SSLException: Connection closed by peer > at com.android.org.conscrypt.NativeCrypto.SSL_do_handshake(Native Method) > at > com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:405) > at com.android.okhttp.Connection.upgradeToTls(Connection.java:146) > at com.android.okhttp.Connection.connect(Connection.java:107) > at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:294) > at > com.android.okhttp.internal.http.HttpEngine.sendSocketRequest(HttpEngine.java:255) > at > com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:206) > at > com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:345) > at > com.android.okhttp.internal.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:89) > at > com.android.okhttp.internal.http.HttpsURLConnectionImpl.connect(HttpsURLConnectionImpl.java:161) > at org.apache.cordova.filetransfer.FileTransfer$4.run(FileTransfer.java:869) > at > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) > at > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) > at java.lang.Thread.run(Thread.java:841) > {noformat} > It can be tested with this code: > {noformat} > var ft = new FileTransfer(), > path = 'squirrel.jpg', > uri = > 'https://prototype.moodle.net/mobile/moodle32/webservice/pluginfile.php/314/mod_resource/content/3/squirrel.jpg?forcedownload=1=616455be9f363cc9631cab89cfcfa1cd'; > ft.download(uri, path, success, error, true); > function success() { > console.log('Success'); > } > function error(data) { > console.log('Error', data); > } > {noformat} -- This message was sent by Atlassian JIRA (v7.6.3#76005) - To unsubscribe, e-mail:
[jira] [Commented] (CB-12551) File-Transfer download/upload fails in Android 4.4 or older using TLS 1.2
[ https://issues.apache.org/jira/browse/CB-12551?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15901564#comment-15901564 ] Kerri Shotts commented on CB-12551: --- Just FYI: Don't use the {{trustAllHosts}} option in production code (except during testing and with your own self-signed certs); since doing so means that you're trusting everyone -- valid certificate or not. > File-Transfer download/upload fails in Android 4.4 or older using TLS 1.2 > - > > Key: CB-12551 > URL: https://issues.apache.org/jira/browse/CB-12551 > Project: Apache Cordova > Issue Type: Bug > Components: Plugin File Transfer >Reporter: Dani Palou > > FileTransfer's download function fails when trying to download a file from a > site using TLS 1.2. This works fine in Android 5 or higher, but it fails in > Android 4.x. > I searched a bit and I found that Android 4.4 should support TLS1.2 but it is > disabled by default. I applied the solution proposed in this post and it > worked for me: > http://stackoverflow.com/a/33567745 > That is, I created the _MySSLSocketFactory_ class in the FileTransfer > project, and I used it in the _trustAllHosts_ function (line 636 of > _FileTransfer.java_): > {noformat} > SSLSocketFactory newFactory = new MySSLSocketFactory(sc.getSocketFactory()); > {noformat} > I'm not sure if this can cause problems with other certificates, I don't know > much about this. It would be nice if the Cordova team could take a look at > this and check if it can be solved. > This is the stacktrace: > {noformat} > Error getting HTTP status code from connection. > javax.net.ssl.SSLException: Connection closed by peer > at com.android.org.conscrypt.NativeCrypto.SSL_do_handshake(Native Method) > at > com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:405) > at com.android.okhttp.Connection.upgradeToTls(Connection.java:146) > at com.android.okhttp.Connection.connect(Connection.java:107) > at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:294) > at > com.android.okhttp.internal.http.HttpEngine.sendSocketRequest(HttpEngine.java:255) > at > com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:206) > at > com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:345) > at > com.android.okhttp.internal.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:89) > at > com.android.okhttp.internal.http.HttpsURLConnectionImpl.connect(HttpsURLConnectionImpl.java:161) > at org.apache.cordova.filetransfer.FileTransfer$4.run(FileTransfer.java:869) > at > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) > at > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) > at java.lang.Thread.run(Thread.java:841) > {noformat} > It can be tested with this code: > {noformat} > var ft = new FileTransfer(), > path = 'squirrel.jpg', > uri = > 'https://prototype.moodle.net/mobile/moodle32/webservice/pluginfile.php/314/mod_resource/content/3/squirrel.jpg?forcedownload=1=616455be9f363cc9631cab89cfcfa1cd'; > ft.download(uri, path, success, error, true); > function success() { > console.log('Success'); > } > function error(data) { > console.log('Error', data); > } > {noformat} -- This message was sent by Atlassian JIRA (v6.3.15#6346) - To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org