fabianonline / telegram_backup

Java app to download all your telegram data.
GNU General Public License v3.0
450 stars 91 forks source link

Error downloading media files: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: No trusted certificate found #71

Closed theno closed 6 years ago

theno commented 6 years ago

Fabian Schlenz, thank you very much for this great telegram backup tool!

I'm running telegram_backup-1.1.0 using the JRE from OpenJDK 9, Ubuntu 16.04.

telegram_backup always stops at the same point while downloading media of a telegram account with many messages (125823) and media files (46604):

> java -jar telegram_backup.jar --account +49xxxxxxxxxxx --trace --anonymize

12:07:05.376 DEBUG Utils.getNewestVersion             : Requesting current release info from https://api.github.com/repos/fabianonline/telegram_backup/releases
12:07:11.143 DEBUG Utils.getNewestVersion             : Found current release version 1.1.0
12:07:11.145 DEBUG Utils.compareVersions              : Comparing versions 1.1.0 and 1.1.0.
12:07:11.146 INFO  CommandLineController.<init>       : CommandLineController started. App version 1.1.0
Telegram_Backup version 1.1.0, Copyright (C) 2016, 2017 Fabian Schlenz

Telegram_Backup comes with ABSOLUTELY NO WARRANTY. This is free software, and you are
welcome to redistribute it under certain conditions; run it with '--license' for details.

12:07:11.147 DEBUG CommandLineController.setupFileBase: Target dir at startup: /aaaa/aaaaa/.aaaaaaaa_aaaaaa (ANONYMIZED)
12:07:11.147 DEBUG CommandLineController.setupFileBase: Target dir after options: /aaaa/aaaaa/.aaaaaaaa_aaaaaa (ANONYMIZED)
Base directory for files: /aaaa/aaaaa/.aaaaaaaa_aaaaaa (ANONYMIZED)
12:07:11.147 DEBUG CommandLineController.<init>       : Initializing TelegramApp
12:07:11.148 TRACE CommandLineController.<init>       : Checking accounts
12:07:11.149 DEBUG CommandLineController.selectAccount: Account requested: +111111111111 (ANONYMIZED)
12:07:11.149 TRACE CommandLineController.selectAccount: Checking accounts for match.
12:07:11.149 TRACE CommandLineController.selectAccount: Checking +111111111111 (ANONYMIZED)
12:07:11.149 TRACE CommandLineController.selectAccount: Matches.
12:07:11.149 DEBUG CommandLineController.selectAccount: accounts.size(): 1
12:07:11.149 DEBUG CommandLineController.selectAccount: account: +111111111111 (ANONYMIZED)
12:07:11.149 DEBUG CommandLineController.<init>       : CommandLineOptions.cmd_login: false
12:07:11.149 INFO  CommandLineController.<init>       : Initializing ApiStorage
12:07:11.150 INFO  CommandLineController.<init>       : Initializing TelegramUpdateHandler
12:07:11.151 INFO  CommandLineController.<init>       : Creating Client
12:07:11.393 INFO  CommandLineController.<init>       : Initializing UserManager
12:07:11.394 DEBUG UserManager.<init>                 : Calling getFullUser
12:07:11.440 DEBUG CommandLineController.<init>       : CommandLineOptions.cmd_login: false
Opening database...
12:07:11.489 DEBUG DatabaseUpdates.<init>             : Registering Database Updates...
12:07:11.489 DEBUG DatabaseUpdates.register           : Registering de.fabianonline.telegram_backup.DB_Update_1 as update to version 1
12:07:11.489 DEBUG DatabaseUpdates.register           : Registering de.fabianonline.telegram_backup.DB_Update_2 as update to version 2
12:07:11.490 DEBUG DatabaseUpdates.register           : Registering de.fabianonline.telegram_backup.DB_Update_3 as update to version 3
12:07:11.490 DEBUG DatabaseUpdates.register           : Registering de.fabianonline.telegram_backup.DB_Update_4 as update to version 4
12:07:11.490 DEBUG DatabaseUpdates.register           : Registering de.fabianonline.telegram_backup.DB_Update_5 as update to version 5
12:07:11.490 DEBUG DatabaseUpdates.register           : Registering de.fabianonline.telegram_backup.DB_Update_6 as update to version 6
12:07:11.490 DEBUG DatabaseUpdates.register           : Registering de.fabianonline.telegram_backup.DB_Update_7 as update to version 7
12:07:11.490 DEBUG DatabaseUpdates.register           : Registering de.fabianonline.telegram_backup.DB_Update_8 as update to version 8
12:07:11.490 DEBUG DatabaseUpdates.doUpdates          : DatabaseUpdate.doUpdates running
12:07:11.490 DEBUG DatabaseUpdates.doUpdates          : Getting current database version
12:07:11.490 DEBUG DatabaseUpdates.doUpdates          : Checking if table database_versions exists
12:07:11.491 DEBUG DatabaseUpdates.doUpdates          : Table exists. Checking max version
12:07:11.491 DEBUG DatabaseUpdates.doUpdates          : version: 8
Database version: 8
12:07:11.491 DEBUG DatabaseUpdates.doUpdates          : Max available database version is 8
12:07:11.491 DEBUG DatabaseUpdates.doUpdates          : No update necessary.
Database is ready.
12:07:11.491 DEBUG CommandLineController.<init>       : CommandLineOptions.val_export: null
You are logged in as Aaaa Aaaaa (ANONYMIZED)
12:07:11.492 INFO  CommandLineController.<init>       : Initializing Download Manager
12:07:11.493 DEBUG CommandLineController.<init>       : Calling DownloadManager.downloadMessages with limit null
12:07:11.493 INFO  DownloadManager._downloadMessages  : This is _downloadMessages with limit null
12:07:11.493 INFO  DownloadManager._downloadMessages  : Downloading the last 100 dialogs
Downloading most recent dialogs... 
12:07:11.603 DEBUG DownloadManager._downloadMessages  : Got 72 dialogs
12:07:11.603 TRACE DownloadManager._downloadMessages  : Updating top message id: 0 => 125823. Dialog type: com.github.badoualy.telegram.tl.api.TLPeerUser
Top message ID is 125823
Top message ID in database is 125823
No new messages to download.
12:07:11.618 INFO  DownloadManager._downloadMessages  : Searching for missing messages in the db
Checking message database for completeness...
12:07:11.632 DEBUG DownloadManager._downloadMessages  : db_count: 125823
12:07:11.633 DEBUG DownloadManager._downloadMessages  : db_max: 125823
12:07:11.633 DEBUG CommandLineController.<init>       : CommandLineOptions.cmd_no_media: false
12:07:11.633 DEBUG CommandLineController.<init>       : Calling DownloadManager.downloadMedia
12:07:11.724 INFO  DownloadManager._downloadMedia     : This is _downloadMedia
12:07:11.724 INFO  DownloadManager._downloadMedia     : Checking if there are messages in the DB with a too old API layer
12:07:12.052 DEBUG DownloadManager._downloadMedia     : Database returned 46604 messages with media
Checking and downloading media.
Legend:
'V' - Video         'P' - Photo         'D' - Document
'S' - Sticker       'A' - Audio         'G' - Geolocation
'.' - Previously downloaded file        'e' - Empty file
' ' - Ignored media type (weblinks or contacts, for example)
'x' - File skipped because of timeout errors
46604 Files to check / download
12:07:12.053 TRACE DownloadManager._downloadMedia     : message 14, …Photo, PhotoFileManager, non-empty, downloaded
.12:07:12.054 TRACE DownloadManager._downloadMedia     : message 15, …Photo, PhotoFileManager, non-empty, downloaded

# ... many more media data logs

.12:07:13.743 TRACE DownloadManager._downloadMedia     : message 122010, …Photo, PhotoFileManager, non-empty, downloaded
.12:07:13.743 TRACE DownloadManager._downloadMedia     : message 122026, …Geo, GeoFileManager, non-empty, not downloaded
javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: No trusted certificate found
    at sun.security.ssl.Alerts.getSSLException(java.base@9-internal/Alerts.java:198)
    at sun.security.ssl.SSLSocketImpl.fatal(java.base@9-internal/SSLSocketImpl.java:1949)
    at sun.security.ssl.Handshaker.fatalSE(java.base@9-internal/Handshaker.java:309)
    at sun.security.ssl.Handshaker.fatalSE(java.base@9-internal/Handshaker.java:303)
    at sun.security.ssl.ClientHandshaker.checkServerCerts(java.base@9-internal/ClientHandshaker.java:1841)
    at sun.security.ssl.ClientHandshaker.serverCertificate(java.base@9-internal/ClientHandshaker.java:1650)
    at sun.security.ssl.ClientHandshaker.processMessage(java.base@9-internal/ClientHandshaker.java:260)
    at sun.security.ssl.Handshaker.processLoop(java.base@9-internal/Handshaker.java:1003)
    at sun.security.ssl.Handshaker.processRecord(java.base@9-internal/Handshaker.java:937)
    at sun.security.ssl.SSLSocketImpl.processInputRecord(java.base@9-internal/SSLSocketImpl.java:1119)
    at sun.security.ssl.SSLSocketImpl.readRecord(java.base@9-internal/SSLSocketImpl.java:1056)
    at sun.security.ssl.SSLSocketImpl.readRecord(java.base@9-internal/SSLSocketImpl.java:955)
    at sun.security.ssl.SSLSocketImpl.performInitialHandshake(java.base@9-internal/SSLSocketImpl.java:1382)
    at sun.security.ssl.SSLSocketImpl.startHandshake(java.base@9-internal/SSLSocketImpl.java:1409)
    at sun.security.ssl.SSLSocketImpl.startHandshake(java.base@9-internal/SSLSocketImpl.java:1393)
    at sun.net.www.protocol.https.HttpsClient.afterConnect(java.base@9-internal/HttpsClient.java:559)
    at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(java.base@9-internal/AbstractDelegateHttpsURLConnection.java:185)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(java.base@9-internal/HttpURLConnection.java:1511)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(java.base@9-internal/HttpURLConnection.java:1439)
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(java.base@9-internal/HttpsURLConnectionImpl.java:235)
    at org.apache.commons.io.FileUtils.copyURLToFile(FileUtils.java:1489)
    at de.fabianonline.telegram_backup.DownloadManager.downloadExternalFile(DownloadManager.java:468)
    at de.fabianonline.telegram_backup.mediafilemanager.GeoFileManager.download(GeoFileManager.java:76)
    at de.fabianonline.telegram_backup.DownloadManager._downloadMedia(DownloadManager.java:341)
    at de.fabianonline.telegram_backup.DownloadManager.downloadMedia(DownloadManager.java:294)
    at de.fabianonline.telegram_backup.CommandLineController.<init>(CommandLineController.java:151)
    at de.fabianonline.telegram_backup.CommandLineRunner.main(CommandLineRunner.java:41)
Caused by: sun.security.validator.ValidatorException: No trusted certificate found
    at sun.security.validator.SimpleValidator.buildTrustedChain(java.base@9-internal/SimpleValidator.java:395)
    at sun.security.validator.SimpleValidator.engineValidate(java.base@9-internal/SimpleValidator.java:134)
    at sun.security.validator.Validator.validate(java.base@9-internal/Validator.java:271)
    at sun.security.ssl.X509TrustManagerImpl.validate(java.base@9-internal/X509TrustManagerImpl.java:343)
    at sun.security.ssl.X509TrustManagerImpl.checkTrusted(java.base@9-internal/X509TrustManagerImpl.java:237)
    at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(java.base@9-internal/X509TrustManagerImpl.java:124)
    at sun.security.ssl.ClientHandshaker.checkServerCerts(java.base@9-internal/ClientHandshaker.java:1820)
    ... 22 more
12:07:13.760 ERROR CommandLineController.<init>       : Exception caught!
javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: No trusted certificate found
    at sun.security.ssl.Alerts.getSSLException(java.base@9-internal/Alerts.java:198)
    at sun.security.ssl.SSLSocketImpl.fatal(java.base@9-internal/SSLSocketImpl.java:1949)
    at sun.security.ssl.Handshaker.fatalSE(java.base@9-internal/Handshaker.java:309)
    at sun.security.ssl.Handshaker.fatalSE(java.base@9-internal/Handshaker.java:303)
    at sun.security.ssl.ClientHandshaker.checkServerCerts(java.base@9-internal/ClientHandshaker.java:1841)
    at sun.security.ssl.ClientHandshaker.serverCertificate(java.base@9-internal/ClientHandshaker.java:1650)
    at sun.security.ssl.ClientHandshaker.processMessage(java.base@9-internal/ClientHandshaker.java:260)
    at sun.security.ssl.Handshaker.processLoop(java.base@9-internal/Handshaker.java:1003)
    at sun.security.ssl.Handshaker.processRecord(java.base@9-internal/Handshaker.java:937)
    at sun.security.ssl.SSLSocketImpl.processInputRecord(java.base@9-internal/SSLSocketImpl.java:1119)
    at sun.security.ssl.SSLSocketImpl.readRecord(java.base@9-internal/SSLSocketImpl.java:1056)
    at sun.security.ssl.SSLSocketImpl.readRecord(java.base@9-internal/SSLSocketImpl.java:955)
    at sun.security.ssl.SSLSocketImpl.performInitialHandshake(java.base@9-internal/SSLSocketImpl.java:1382)
    at sun.security.ssl.SSLSocketImpl.startHandshake(java.base@9-internal/SSLSocketImpl.java:1409)
    at sun.security.ssl.SSLSocketImpl.startHandshake(java.base@9-internal/SSLSocketImpl.java:1393)
    at sun.net.www.protocol.https.HttpsClient.afterConnect(java.base@9-internal/HttpsClient.java:559)
    at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(java.base@9-internal/AbstractDelegateHttpsURLConnection.java:185)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(java.base@9-internal/HttpURLConnection.java:1511)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(java.base@9-internal/HttpURLConnection.java:1439)
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(java.base@9-internal/HttpsURLConnectionImpl.java:235)
    at org.apache.commons.io.FileUtils.copyURLToFile(FileUtils.java:1489)
    at de.fabianonline.telegram_backup.DownloadManager.downloadExternalFile(DownloadManager.java:468)
    at de.fabianonline.telegram_backup.mediafilemanager.GeoFileManager.download(GeoFileManager.java:76)
    at de.fabianonline.telegram_backup.DownloadManager._downloadMedia(DownloadManager.java:341)
    at de.fabianonline.telegram_backup.DownloadManager.downloadMedia(DownloadManager.java:294)
    at de.fabianonline.telegram_backup.CommandLineController.<init>(CommandLineController.java:151)
    at de.fabianonline.telegram_backup.CommandLineRunner.main(CommandLineRunner.java:41)
Caused by: sun.security.validator.ValidatorException: No trusted certificate found
    at sun.security.validator.SimpleValidator.buildTrustedChain(java.base@9-internal/SimpleValidator.java:395)
    at sun.security.validator.SimpleValidator.engineValidate(java.base@9-internal/SimpleValidator.java:134)
    at sun.security.validator.Validator.validate(java.base@9-internal/Validator.java:271)
    at sun.security.ssl.X509TrustManagerImpl.validate(java.base@9-internal/X509TrustManagerImpl.java:343)
    at sun.security.ssl.X509TrustManagerImpl.checkTrusted(java.base@9-internal/X509TrustManagerImpl.java:237)
    at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(java.base@9-internal/X509TrustManagerImpl.java:124)
    at sun.security.ssl.ClientHandshaker.checkServerCerts(java.base@9-internal/ClientHandshaker.java:1820)
    ... 22 common frames omitted

----- EXIT -----
fabianonline commented 6 years ago

Thanks for the report. This bug will be fixed in the next release.