Overview
Features
Download
Documentation
Community
Add-Ons & Services

problem with using NetSSL

Please post support and help requests here.

problem with using NetSSL

Postby argoneus » 10 May 2007, 18:53

i've compiled poco-1.2.9-ssl and am using NetSSL in one of my projects. i've followed the example cited at http://www.appinf.com/poco/wiki/tiki-pagehistory.php?page=NetSSL&preview=9 to configure my openSSL settings as part of my application XML config file.

and from what i've read the application should automatically read the openSSL settings, but for some reason i keep getting the following exception:

"No PassPhrasehandler known with the name KeyFileHandler"

is there something else i need to do in order to get SSLManager to recognize the KeyFileHandler?
argoneus
 
Posts: 12
Joined: 19 Oct 2006, 19:03

Re: problem with using NetSSL

Postby argoneus » 11 May 2007, 16:54

update: i've used the following code to successfully make an SSL connection:
Code: Select all

    Poco::Net::HTTPClientSession* session = new ::Poco::Net::HTTPClientSession();
     if (voicePort == 443){
              Poco::SharedPtr ptrConsole = new KeyFileHandler(false);   
         Poco::SharedPtr ptrCert = new AcceptCertificateHandler(false);
         Poco::SharedPtr ptrContext = new Context("any.pem", "rootcert.pem", false, Context::VERIFY_RELAXED, 9, false, "ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH");
         SSLManager::instance().initializeClient(ptrConsole, ptrCert, ptrContext);
                  session = new Poco::Net::HTTPSClientSession();
          }

this works, but i'd much rather have poco read the settings from my XML config file instead of hard-coding these values. for some reason poco raises the exception:

"No PassPhrasehandler? known with the name KeyFileHandler"

whenever i try to initialize my SSL context through the XML config file
argoneus
 
Posts: 12
Joined: 19 Oct 2006, 19:03

Re: problem with using NetSSL

Postby peter » 14 May 2007, 07:40

> i've compiled poco-1.2.9-ssl and am using NetSSL in one of my projects. i've followed the example cited at http://www.appinf.com/poco/wiki/tiki-pagehistory.php?page=NetSSL&preview=9 to configure my openSSL settings as part of my application XML config file.
>
> and from what i've read the application should automatically read the openSSL settings, but for some reason i keep getting the following exception:
>
> "No PassPhrasehandler known with the name KeyFileHandler"
>
> is there something else i need to do in order to get SSLManager to recognize the KeyFileHandler?

Normally, no.
The KeyFileHandler exports it's class automatically via

POCO_REGISTER_KEYFACTORY(NetSSL_API,KeyFileHandler)

in the cpp file.
Can you try to set a breakpoint in the PrivateKeyFactoryMgr
class to see if setFactory is called for keyFileHandler?

br

Peter

peter
 
Posts: 67
Joined: 11 Jul 2006, 16:26
Location: Austria

Re: Re: problem with using NetSSL

Postby argoneus » 15 May 2007, 21:32

> > i've compiled poco-1.2.9-ssl and am using NetSSL in one of my projects. i've followed the example cited at http://www.appinf.com/poco/wiki/tiki-pagehistory.php?page=NetSSL&preview=9 to configure my openSSL settings as part of my application XML config file.
> >
> > and from what i've read the application should automatically read the openSSL settings, but for some reason i keep getting the following exception:
> >
> > "No PassPhrasehandler known with the name KeyFileHandler"
> >
> > is there something else i need to do in order to get SSLManager to recognize the KeyFileHandler?
>
> Normally, no.
> The KeyFileHandler exports it's class automatically via
>
> POCO_REGISTER_KEYFACTORY(NetSSL_API,KeyFileHandler)
>
> in the cpp file.
> Can you try to set a breakpoint in the PrivateKeyFactoryMgr
> class to see if setFactory is called for keyFileHandler?
>
> br
>
> Peter
>
>

i ran my app (using the XML config.. I removed the hard-coded settings shown in the above code sample) in gdb and set a breakpoint at setFactory() in PrivateKeyFactoryMgr.cpp.

The breakpoint was never hit, so for some reason the KeyFileHandler isn't automatically exporting its class. In addition, I received the same exception as before.
argoneus
 
Posts: 12
Joined: 19 Oct 2006, 19:03

Re: Re: Re: problem with using NetSSL

Postby peter » 16 May 2007, 13:39

//Can you send me a mini version of your project that illustrates the problem?

My email is x.y@appinf.com with x =peter, y =schojer.

UPDATE:
I've changed the way how factories are registered in NetSSL. Instead of relying on
static registration when the library is loaded (which is a bad idea anyway), I now simply register the default factories in the manager itself (which will always work).

So simply send me an email and I will send you the updated source of PocoNetSSL.
no mini project required :-)

br
Peter

peter
 
Posts: 67
Joined: 11 Jul 2006, 16:26
Location: Austria


Return to Support

Who is online

Users browsing this forum: No registered users and 4 guests

cron