diff options
author | Daniel Gultsch <daniel@gultsch.de> | 2015-10-12 13:18:20 +0200 |
---|---|---|
committer | Daniel Gultsch <daniel@gultsch.de> | 2015-10-12 13:18:20 +0200 |
commit | 212d1a8c91d5b83d1132d3a02664607ce37f8ecf (patch) | |
tree | 36cf3f3c387097075af0c404548f27dc59800867 /src/main/java/eu/siacs/conversations/services/XmppConnectionService.java | |
parent | 933538a39da9fb80025e07fc173514f45033c261 (diff) |
add config variable to enable x509 verification
Diffstat (limited to '')
-rw-r--r-- | src/main/java/eu/siacs/conversations/services/XmppConnectionService.java | 33 |
1 files changed, 14 insertions, 19 deletions
diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java index f3bd545ae..7a39bd062 100644 --- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java @@ -1311,25 +1311,18 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa account.setOption(Account.OPTION_DISABLED, true); createAccount(account); callback.onAccountCreated(account); - try { - getMemorizingTrustManager().getNonInteractive().checkClientTrusted(chain, "RSA"); - } catch (CertificateException e) { - callback.informUser(R.string.certificate_chain_is_not_trusted); + if (Config.X509_VERIFICATION) { + try { + getMemorizingTrustManager().getNonInteractive().checkClientTrusted(chain, "RSA"); + } catch (CertificateException e) { + callback.informUser(R.string.certificate_chain_is_not_trusted); + } } } else { callback.informUser(R.string.account_already_exists); } - } catch (KeyChainException e) { - callback.informUser(R.string.unable_to_parse_certificate); - } catch (InterruptedException e) { + } catch (Exception e) { callback.informUser(R.string.unable_to_parse_certificate); - e.printStackTrace(); - } catch (CertificateEncodingException e) { - callback.informUser(R.string.unable_to_parse_certificate); - e.printStackTrace(); - } catch (InvalidJidException e) { - callback.informUser(R.string.unable_to_parse_certificate); - e.printStackTrace(); } } }).start(); @@ -1344,12 +1337,14 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa if (account.getJid().toBareJid().equals(info.first)) { account.setPrivateKeyAlias(alias); databaseBackend.updateAccount(account); - try { - getMemorizingTrustManager().getNonInteractive().checkClientTrusted(chain, "RSA"); - } catch (CertificateException e) { - showErrorToastInUi(R.string.certificate_chain_is_not_trusted); + if (Config.X509_VERIFICATION) { + try { + getMemorizingTrustManager().getNonInteractive().checkClientTrusted(chain, "RSA"); + } catch (CertificateException e) { + showErrorToastInUi(R.string.certificate_chain_is_not_trusted); + } + account.getAxolotlService().regenerateKeys(true); } - account.getAxolotlService().regenerateKeys(true); } else { showErrorToastInUi(R.string.jid_does_not_match_certificate); } |