Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Problem using RSA algorythme in QCA
Forum Updated to NodeBB v4.3 + New Features

Problem using RSA algorythme in QCA

Scheduled Pinned Locked Moved Qt Creator and other tools
18 Posts 4 Posters 12.5k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    SamFaye
    wrote on 8 Aug 2011, 12:11 last edited by
    #1

    I'm using QCA in my programme to genrate public and private keys.
    But when I do write the code above:
    @if(!QCA::isSupported("pkey") ||
    !QCA::PKey::supportedIOTypes("pkey").contains(QCA::PKey::RSA))

     {
        qDebug() << "RSA not supported!\n";
     }
     else
     {
          //Génération de la clé privé
         //QCA::DLGroup dLGroup(1024,1024);
         QCA::PrivateKey seckey = QCA::KeyGenerator().createRSA(1024);
     }@
    

    I have the message
    "RSA not supported!\n"
    Whitch is displayed.

    -NB-
    I'm using the source code of QCA in my project.

    This is the list of files included:
    qca_basic.h/.cpp
    qca_cert.h/.cpp
    qca_core.h/.cpp
    qca_export.h/.cpp
    qca_keystore.h/.cpp
    qca_publickey.h/.cpp
    qca_securelayer.h/.cpp
    qca_securemessage.h/.cpp
    qca_support.h/.cpp
    qca_textfilter.h/.cpp
    qca_tools.h/.cpp
    qca_provider.h/.cpp
    qca_pipe.h/.cpp
    qca_default.cpp
    qca_plugin.h/.cpp
    qca_safeobj.h/.cpp

    Why the RSA is not supported??

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SamFaye
      wrote on 8 Aug 2011, 12:33 last edited by
      #2

      Nobody have a answer??

      1 Reply Last reply
      0
      • Z Offline
        Z Offline
        ZapB
        wrote on 8 Aug 2011, 12:48 last edited by
        #3

        Please give people a chance to answer. We are all volunteers on here, not paid support staff.

        As to your problem, QCA itself provides only an interface. The actual functionality is provided by the various QCA plugins. In this case I think you need to make sure that the qca-ossl plugin is actually getting loaded by your application.

        I have used code similar to the following to show info about what facilities your QCA install is able to provide:

        @
        QString info;
        QCA::scanForPlugins();

        // this gives us all the plugin providers as a list
        QCA::ProviderList qcaProviders = QCA::providers();
        for ( int i = 0; i < qcaProviders.size(); ++i )
        {
            // each provider has a name, which we can display
            info += qcaProviders[i]->name() + ": ";
            // ... and also a list of features
            QStringList capabilities = qcaProviders[i]->features();
            // we turn the string list back into a single string,
            // and display it as well
            info += capabilities.join(", ") + "\n";
        }
        
        // Note that the default provider isn't included in
        // the result of QCA::providers()
        info += "default: ";
        // However it is still possible to get the features
        // supported by the default provider
        QStringList capabilities = QCA::defaultFeatures();
        info += capabilities.join(", ") + "\n";
        qDebug() << info;
        

        @

        Nokia Certified Qt Specialist
        Interested in hearing about Qt related work

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SamFaye
          wrote on 8 Aug 2011, 12:56 last edited by
          #4

          Hello ZapB
          When I use the code you're posted I have the result below:

          @default: random, md5, sha1, keystorelist@

          1 Reply Last reply
          0
          • Z Offline
            Z Offline
            ZapB
            wrote on 8 Aug 2011, 12:59 last edited by
            #5

            As I suspected. That means the qca-ossl plugin is not getting loaded at runtime. What platform are you on? Have you installed qca-ossl either from system packages on Linux or from source elsewhere?

            Nokia Certified Qt Specialist
            Interested in hearing about Qt related work

            1 Reply Last reply
            0
            • Z Offline
              Z Offline
              ZapB
              wrote on 8 Aug 2011, 12:59 last edited by
              #6

              For info, when qca-ossl is loaded you should see output like this:

              @
              qca-ossl: sha1, sha0, ripemd160, md4, md5, sha224, sha256, sha384, sha512, hmac(md5), hmac(sha1), hmac(sha224), hmac(sha256), hmac(sha384), hmac(sha512), hmac(ripemd160), aes128-ecb, aes128-cfb, aes128-cbc, aes128-cbc-pkcs7, aes128-ofb, aes192-ecb, aes192-cfb, aes192-cbc, aes192-cbc-pkcs7, aes192-ofb, aes256-ecb, aes256-cbc, aes256-cbc-pkcs7, aes256-cfb, aes256-ofb, blowfish-ecb, blowfish-cbc-pkcs7, blowfish-cbc, blowfish-cfb, blowfish-ofb, tripledes-ecb, tripledes-cbc, des-ecb, des-ecb-pkcs7, des-cbc, des-cbc-pkcs7, des-cfb, des-ofb, cast5-ecb, cast5-cbc, cast5-cbc-pkcs7, cast5-cfb, cast5-ofb, pbkdf1(sha1), pbkdf2(sha1), pkey, dlgroup, rsa, dsa, dh, cert, csr, crl, certcollection, pkcs12, tls, cms, ca default: random, md5, sha1, keystorelist
              @

              Nokia Certified Qt Specialist
              Interested in hearing about Qt related work

              1 Reply Last reply
              0
              • S Offline
                S Offline
                SamFaye
                wrote on 8 Aug 2011, 13:08 last edited by
                #7

                What platform are you on?

                I'm using Fedora 14

                Have you installed qca-ossl either from system packages on Linux or from source elsewhere?

                qca-ossl is not installed.
                I don't want to installed on the system. I want to put it in my project source as the other. What files should I add to my sources for this plugin is loaded in my application

                Edit: removed code tags [ZapB]

                1 Reply Last reply
                0
                • Z Offline
                  Z Offline
                  ZapB
                  wrote on 8 Aug 2011, 13:17 last edited by
                  #8

                  I'm not sure you can do that easily. QCA is designed around a plugin architecture. Why do you not want to simply link against QCA library and allow it to load the plugins?

                  If you really want to include this in your project directly then you'll need to download the source code for qca-ossl and hack it into submission. I do not know exactly which files you'll need but from memory it consists of a small number of files.

                  Nokia Certified Qt Specialist
                  Interested in hearing about Qt related work

                  1 Reply Last reply
                  0
                  • S Offline
                    S Offline
                    SamFaye
                    wrote on 8 Aug 2011, 13:25 last edited by
                    #9

                    I want my application to be supported by other systems of exploitation such as Mac OS, Windows.

                    If the method that you can offer me that the application can be compiled on other OS without installing qca-ssl, how can make the connection? IHow can I link against QCA library and allow it to load the plugins?

                    1 Reply Last reply
                    0
                    • Z Offline
                      Z Offline
                      ZapB
                      wrote on 8 Aug 2011, 13:35 last edited by
                      #10

                      So you just ship the QCA lib and qca-ossl plugin (and openssl of course) with your application on those platforms. We do it with out any problems on Linux and Windows.

                      You can put the qca2.dll and the OpenSSL dll's (libeay32.dll, ssleay32.dll, libssl32.dll) into the install dir next to your application. The qca-ossl is a plugin and should be put into a subdir called crypto in order for the plugin system to be able to find it at runtime.

                      I would not bother trying to compile qca and qca-ossl directly into your application.

                      HTH

                      Nokia Certified Qt Specialist
                      Interested in hearing about Qt related work

                      1 Reply Last reply
                      0
                      • L Offline
                        L Offline
                        lgeyer
                        wrote on 8 Aug 2011, 13:37 last edited by
                        #11

                        Just redistribute your application with the needed shared libraries (qca, qca-ossl and openssl).
                        You might give a static QCA build a try which "integrates" the code in your project as well.

                        1 Reply Last reply
                        0
                        • S Offline
                          S Offline
                          SamFaye
                          wrote on 9 Aug 2011, 09:08 last edited by
                          #12

                          I joined the sources of qca-ossl in my project, but there are files of openssl that are imported in the file qca-ossl.cpp, but the application does not see them. Do I have to integrate the sources of openssl in my project?

                          At the instruction: INSTALL (TARGETS qca-ossl LIBRARY DESTINATION $ {qca_PLUGINSDIR} ) I changed by putting: INSTALL (TARGETS qca-ossl LIBRARY DESTINATION / usr / share / monRep). Because he could not find the directory $ {qca_PLUGINSDIR}

                          This is the CMakeList.txt of the qca-ossl:

                          @########################################################################################
                          ########################################################################################

                          CMAKE PROJECT

                          ########################################################################################
                          ########################################################################################
                          PROJECT (QCA_OSSL)

                          cmake_minimum_required( VERSION 2.6 )

                          SET(QCA_OSSL_SOURCES qca-ossl.cpp)

                          #MY_AUTOMOC( QCA_OSSL_SOURCES )

                          ADD_LIBRARY(qca-ossl SHARED ${QCA_OSSL_SOURCES})
                          INCLUDE_DIRECTORIES(${OPENSSL_INCLUDE_DIR})
                          TARGET_LINK_LIBRARIES(qca-ossl ${QT_QTCORE_LIBRARY})
                          TARGET_LINK_LIBRARIES(qca-ossl qca)
                          TARGET_LINK_LIBRARIES(qca-ossl ${OPENSSL_LIBRARIES})
                          if(APPLE)
                          TARGET_LINK_LIBRARIES(qca-ossl crypto)
                          endif(APPLE)
                          IF (WIN32)
                          ADD_DEFINITIONS(-DOSSL_097)
                          TARGET_LINK_LIBRARIES(qca-ossl gdi32)
                          TARGET_LINK_LIBRARIES(qca-ossl wsock32)
                          TARGET_LINK_LIBRARIES(qca-ossl ${OPENSSL_EAY_LIBRARIES})
                          ENDIF (WIN32)

                          INSTALL(TARGETS qca-ossl LIBRARY DESTINATION ${qca_PLUGINSDIR})@

                          When I execute my application I have the error message
                          @[ 98%] Building CXX object composants/qca-ossl-0.1/CMakeFiles/qca-ossl.dir/qca-ossl.cpp.o
                          In file included from /usr/include/QtCrypto/qca.h:36:0,
                          from /usr/include/QtCrypto/QtCrypto:1,
                          from /home/sfaye/Qt/in-tactick/int-tactic/xsimul/trunk/sources/composants/qca-ossl-0.1/qca-ossl.cpp:21:
                          /usr/include/QtCrypto/qca_core.h:45:19: erreur fatale: QString : Aucun fichier ou dossier de ce type
                          compilation terminée.
                          make[2]: *** [composants/qca-ossl-0.1/CMakeFiles/qca-ossl.dir/qca-ossl.cpp.o] Erreur 1
                          make[1]: *** [composants/qca-ossl-0.1/CMakeFiles/qca-ossl.dir/all] Erreur 2
                          make: *** [all] Erreur 2
                          Le processus "/usr/bin/make" s'est terminé avec le code 2.@
                          Help please.

                          1 Reply Last reply
                          0
                          • S Offline
                            S Offline
                            SamFaye
                            wrote on 9 Aug 2011, 10:07 last edited by
                            #13

                            Nobody can't help me??

                            1 Reply Last reply
                            0
                            • Z Offline
                              Z Offline
                              ZapB
                              wrote on 9 Aug 2011, 10:13 last edited by
                              #14

                              Once again, please be patient. 1 hour is not enough time for people to see your question and get a response. Please wait longer before bumping a thread.

                              Why do you not just try it the way we suggested? ie Build qca and qca-ossl normally then ship them with your executable?

                              As for your specific question, of course qca-ossl requires headers form openssl. It is wrapping the openssl functionality. So you will need to have the openssl headers in a path searched by the compiler. You will still need to deploy the openssl libs anyway - unless you plan on integrating those into your project too?!?!

                              Nokia Certified Qt Specialist
                              Interested in hearing about Qt related work

                              1 Reply Last reply
                              0
                              • S Offline
                                S Offline
                                SamFaye
                                wrote on 9 Aug 2011, 11:48 last edited by
                                #15

                                I want my project to be compiled on Windows, Mac and Linux system without installing any thing. That is why I want to integrate the souces code of those tools.

                                1 Reply Last reply
                                0
                                • G Offline
                                  G Offline
                                  goetz
                                  wrote on 9 Aug 2011, 12:18 last edited by
                                  #16

                                  You must provide the Qt libs anyways. So just add the QCA and openssl libs to your bundle and you're done. Even if you're getting QCA statically into your application, you will have to provide openssl libs. So you save nothing with your approach.

                                  http://www.catb.org/~esr/faqs/smart-questions.html

                                  1 Reply Last reply
                                  0
                                  • S Offline
                                    S Offline
                                    SamFaye
                                    wrote on 9 Aug 2011, 12:37 last edited by
                                    #17

                                    How can I add the QCA and openssl libs to the bundle??

                                    1 Reply Last reply
                                    0
                                    • Z Offline
                                      Z Offline
                                      ZapB
                                      wrote on 9 Aug 2011, 12:49 last edited by
                                      #18

                                      I'll leave Volker to answer for the Mac side of things but on Windows I use NSIS to build an installer. I've already told you how to structure your installation dir on Windows but here it is again:

                                      @
                                      $INSTALLDIR
                                      $INSTALLDIR/application.exe
                                      $INSTALLDIR/$QTLIBS
                                      $INSTALLDIR/{libeay32.dll, ssleay32.dll, libssl32.dll}
                                      $INSTALLDIR/qca2.dll
                                      $INSTALLDIR/crypto/qca-ossl.dll
                                      @

                                      This really is much less work than trying to compile all of these projects into your application.

                                      Nokia Certified Qt Specialist
                                      Interested in hearing about Qt related work

                                      1 Reply Last reply
                                      0

                                      1/18

                                      8 Aug 2011, 12:11

                                      • Login

                                      • Login or register to search.
                                      1 out of 18
                                      • First post
                                        1/18
                                        Last post
                                      0
                                      • Categories
                                      • Recent
                                      • Tags
                                      • Popular
                                      • Users
                                      • Groups
                                      • Search
                                      • Get Qt Extensions
                                      • Unsolved