In 'connect': ssl_connect returned = 1 errno = 0 state = SSLv3 read server certificate B: Certificate verify failed (OpenSSL: SSL: sslerror)

Source: Internet
Author: User
Tags change settings imap ssl certificate ssl connection

This error has always occurred when I recently used Ruby libraries..

When using the net/IMAP library or the net/HTTP Library (mainly using HTTPS and HTTPS using SSL), the details are as follows:

 

Error message: e:/ruby200/lib/Ruby/2.0.0/NET/IMAP. RB: 1454: In 'connect': ssl_connect returned = 1 errno = 0 state = SSLv3 read server certificate B: Certificate verify failed (OpenSSL: SSL: sslerror)

 

The prompt shows that the certificate verification has failed. Why?

SSL connection is a Secure Sockets Layer connection. It encrypts data at the transmission layer to protect the data transmitted in network communication. The SSL certificate is required to use this certificate. In Ruby, the certificate is not verified by default. In the source code of the net/HTTP library

There is an instance variable @ use_ssl = false. The default SSL usage is false, that is, it is not used. (I don't know much about this. You can ignore it)

 

 

Specifically, the steps are as follows:

1. Download the certificate. Some certificates seem too early to work. I used this token.

2. then place the certificate in the appropriate place. It is generally in the root directory of the Ruby or rails installation place, for example, my: e: \ ruby200 \ cacert. pem

3. Set the environment variable. In command line (CMD), enter SET ssl_cert_file = E: \ ruby200 \ cacert. Pem, which is only a temporary environment variable. If it is a fixed environment variable, go to the next step.

4. Set fixed environment variables. Under win7, choose Control Panel> system and maintenance> system> advanced system settings (or change Settings> advanced), go to environment variables, select system variables, and create a new one. Enter the following

In this way, you can.

 

For more information, see https://gist.github.com/fnichol/867550.

 

In 'connect': ssl_connect returned = 1 errno = 0 state = SSLv3 read server certificate B: Certificate verify failed (OpenSSL: SSL: sslerror)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.