Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flutter: CERTIFICATE_VERIFY_FAILED: unable to get local issuer certificate #199

Open
WernerRaathAtPolymorph opened this issue Jul 1, 2022 · 7 comments
Labels
bug Something isn't working

Comments

@WernerRaathAtPolymorph
Copy link

When running the same functionality with Dart, all works well. When it runs within a Flutter App, it throws this bad boy:

HandshakeException: Handshake error in client (OS Error: 
I/flutter (26972):      CERTIFICATE_VERIFY_FAILED: unable to get local issuer certificate(handshake.cc:393))

I use a Gmail email address and it seems to fail on Discover

final ClientConfig? config = await Discover.discover(emailAddress);
@robert-virkus
Copy link
Member

Interesting, do you mind sharing the used email address? You can send it to me directly: robert-at-enough-dot-de

@robert-virkus robert-virkus added the bug Something isn't working label Jul 1, 2022
@dfangys
Copy link

dfangys commented Sep 9, 2022

did you fix it?
I'm facing the same

@robert-virkus
Copy link
Member

Hi Guys, in the meantime I have move the discovery part into a dedicated project:
https://github.com/Enough-Software/enough_mail_discovery and https://pub.dev/packages/enough_mail_discovery

I never noticed a problem with a gmail address, when I check a gmail address on the demo on https://enough.de/enough_mail_discovery/ the results are shown correctly, too.

Please provide a project that reproduces the problem so that I can work out problems better.

@dfangys
Copy link

dfangys commented Sep 9, 2022

so that I can work out problems better.

I'm using my own mail server I have this issue with this package, I'm using other third-party apps like my mail it works fine!

I/flutter ( 6246): Subject: chfjf I/flutter ( 6246): MIME-Version: 1.0 I/flutter ( 6246): Content-Type: multipart/mixed; boundary="DR7yw6pXk0_RPU-kLM" I/flutter ( 6246): Content-Transfer-Encoding: base64 I/flutter ( 6246): I/flutter ( 6246): --DR7yw6pXk0_RPU-kLM I/flutter ( 6246): SMTP-null S: 250-VRFY I/flutter ( 6246): SMTP-null S: 250-ETRN I/flutter ( 6246): SMTP-null S: 250-STARTTLS I/flutter ( 6246): SMTP-null S: 250-ENHANCEDSTATUSCODES I/flutter ( 6246): SMTP-null S: 250-8BITMIME I/flutter ( 6246): SMTP-null S: 250-DSN I/flutter ( 6246): SMTP-null S: 250-SMTPUTF8 I/flutter ( 6246): SMTP-null S: 250 CHUNKING I/flutter ( 6246): SMTP-null C: STARTTLS I/flutter ( 6246): SMTP-null S: 220 2.0.0 Ready to start TLS I/flutter ( 6246): SMTP-null A: STARTTLS: upgrading socket to secure one... E/flutter ( 6246): [ERROR:flutter/lib/ui/ui_dart_state.cc(198)] Unhandled Exception: Something went wrong, please try again! MailException: HandshakeException: Handshake error in client (OS Error: E/flutter ( 6246): CERTIFICATE_VERIFY_FAILED: unable to get local issuer certificate(handshake.cc:393)) E/flutter ( 6246): HandshakeException: Handshake error in client (OS Error: E/flutter ( 6246): CERTIFICATE_VERIFY_FAILED: unable to get local issuer certificate(handshake.cc:393))

@robert-virkus
Copy link
Member

@dfangys your problem seems to be different from the original posters one.
Could it be that you are using a self-signed certificate?
Have you tried specifying a bad certificate handler?

final mailClient =  MailClient(account, onBadCertificate: (certificate) {
    print('received bad certificate $certificate');
    // DANGER-ZONE: just accept all certificates
   return true;
},
);

From the docs:

  /// [onBadCertificate] is an optional handler for unverifiable certificates.
  /// The handler receives the [X509Certificate], and can inspect it and decide
  /// (or let the user decide) whether to accept the connection or not.
  /// The handler should return true to continue the [SecureSocket] connection.

@dfangys
Copy link

dfangys commented Sep 9, 2022

i'll check and reply to you back, thanks

@mike-bambu
Copy link

hi @dfangys I have the same problem, could you solve this detail?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants