HTTPS Error..."Segmentation fault" in Ubuntu

Please post support and help requests here.
Posts: 3
Joined: 18 Dec 2009, 10:38

HTTPS Error..."Segmentation fault" in Ubuntu

Postby vanxining » 18 Dec 2009, 10:50

Hi,everyone.I encounter a problem when using NetSSL in Linux.
Here is the code:

Code: Select all

#include "Poco/Util/Application.h"
#include "Poco/URIStreamOpener.h"
#include "Poco/StreamCopier.h"
#include "Poco/Path.h"
#include "Poco/URI.h"
#include "Poco/SharedPtr.h"
#include "Poco/Exception.h"
#include "Poco/Net/HTTPRequest.h"
#include "Poco/Net/HTTPResponse.h"
#include "Poco/Net/HTTPSClientSession.h"
#include "Poco/Net/SSLManager.h"
#include "Poco/Net/KeyConsoleHandler.h"
#include "Poco/Net/ConsoleCertificateHandler.h"
#include <memory>
#include <iostream>

using Poco::Util::Application;
using Poco::URIStreamOpener;
using Poco::StreamCopier;
using Poco::Path;
using Poco::URI;
using Poco::SharedPtr;
using Poco::Exception;
using Poco::Net::SSLManager;
using Poco::Net::Context;
using Poco::Net::KeyConsoleHandler;
using Poco::Net::PrivateKeyPassphraseHandler;
using Poco::Net::InvalidCertificateHandler;
using Poco::Net::ConsoleCertificateHandler;

class App:public Poco::Util::Application
        int init(int argc, char** argv)
            return 0;
           if (argc != 2)
              Path p(argv[0]);
              std::cerr << "usage: " << p.getBaseName() << " <uri>" << std::endl;
              std::cerr << "       Download <uri> to standard output." << std::endl;
              std::cerr << "       Works with http, https, ftp and file URIs." << std::endl;
              return 0;
        int run()
            //URI uri("");//This works
            URI uri("");//This doesn't work
            std::string path(uri.getPathAndQuery());
            if(path.empty()) path = "/";

            SharedPtr<InvalidCertificateHandler> ptrCert = new ConsoleCertificateHandler(false);
            Context::Ptr ptrContext = new Context(Context::CLIENT_USE, "", "", "rootcert.pem",
                            Context::VERIFY_RELAXED, 9, false, "ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH");
            SSLManager::instance().initializeClient(0, ptrCert, ptrContext);

            Poco::Net::HTTPSClientSession s(uri.getHost());
            Poco::Net::HTTPRequest req;
            Poco::Net::HTTPResponse res;

                std::istream& rs=s.receiveResponse(res);
                StreamCopier::copyStream(rs, std::cout);
            catch (Exception& exc)
                std::cerr << exc.displayText() << std::endl;
                return 1;
            return 0;


Code: Select all

WARNING: Certificate verification failed
Issuer Name:  /C=US/ST=CA/L=San Jose/O=Enterprise Mobility/OU=EWLAN/CN=Motorola
Subject Name: /C=US/ST=CA/L=San Jose/O=Enterprise Mobility/OU=EWLAN/CN=Motorola

The certificate yielded the error: self signed certificate

The error occurred in the certificate chain at position 0
Accept the certificate (y,n)? y
Segmentation fault


Posts: 1198
Joined: 11 Jul 2006, 16:27
Location: Austria

Re: HTTPS Error..."Segmentation fault" in Ubuntu

Postby guenter » 18 Dec 2009, 12:32

Posts: 3
Joined: 18 Dec 2009, 10:38

Re: HTTPS Error..."Segmentation fault" in Ubuntu

Postby vanxining » 17 Jan 2010, 16:20

Hi, it seems that there is a new problem, the program will return an error:

Code: Select all

Certificate validation error: Unacceptable certificate from application verification failure

On, the explanation to this error is:

Code: Select all

50 X509_V_ERR_APPLICATION_VERIFICATION: application verification failure
an application specific error.Unused.


Is there a solution to this problem??
Atually,this incorrect certification is just to indicate the visitors they are visiting the real site(url).


p.s.I'm sorry that I have poor knowledge about SSL,and I just want to write an auto-login program to enjoy the WLAN provided by the school...

Posts: 3
Joined: 18 Dec 2009, 10:38

Re: HTTPS Error..."Segmentation fault" in Ubuntu

Postby vanxining » 17 Jan 2010, 16:54

Change ConsoleCertificateHandler to AcceptCertificateHandler doesn't work too.

Return to “Support”

Who is online

Users browsing this forum: No registered users and 1 guest