Index: signHash/cryptotoken.cpp
===================================================================
--- signHash/cryptotoken.cpp	(revision f626f58c237e35cbbd3875f861e5cc047dc63313)
+++ signHash/cryptotoken.cpp	(revision ce57b4529df835ba8d80a34aceea16e66d9bed88)
@@ -461,4 +461,138 @@
 }
 
+/*
+std::vector<CK_OBJECT_HANDLE> CryptoToken::findObject(CK_OBJECT_CLASS objectClass, CK_ULONG max = 2) const {
+    if (!fl) {
+        throw std::runtime_error("PKCS11 is not loaded");
+    }
+    CK_ATTRIBUTE searchAttribute = {CKA_CLASS, &objectClass, sizeof(objectClass)};
+
+
+
+    C(FindObjectsInit, session, &searchAttribute, 1);
+    CK_ULONG objectCount = max;
+    std::vector<CK_OBJECT_HANDLE> objectHandle(objectCount);
+    C(FindObjects, session, objectHandle.data(), objectHandle.size(), &objectCount);
+    C(FindObjectsFinal, session);
+    objectHandle.resize(objectCount);
+    return objectHandle;
+}
+*/
+
+QStringList CryptoToken::getPrivateKeyLabels(QString pin)
+{
+    QStringList list;
+
+    QString error("");
+    CK_RV rv;
+
+    CK_SESSION_HANDLE hSession = CK_INVALID_HANDLE;
+    CK_SLOT_ID slotID;
+
+    // initialize criptoki
+    rv = C_Initialize(NULL_PTR);
+    if (rv != CKR_OK)
+    {
+        if (rv == CKR_DEVICE_ERROR)
+        {
+            error = returnErrorToQString(rv);
+            qDebug(qPrintable(error));
+            throw std::runtime_error(qPrintable(error));
+        }
+        error = returnErrorToQString(rv);
+        qDebug(qPrintable(error));
+        throw std::runtime_error(qPrintable(error));
+    }
+
+    hSession = openSession((char *) qPrintable(pin), slotID);
+    if (hSession == CK_INVALID_HANDLE)
+    {
+        qDebug("Fallo ptr_SC->openSession");
+        rv = C_Finalize(NULL_PTR);
+        qDebug("C_Finalize: rv = %x",rv);
+        assert(rv == CKR_OK);
+        throw std::runtime_error("Error openning a session");
+    }
+
+    CK_OBJECT_CLASS objectClass = CKO_PRIVATE_KEY;
+    //CK_OBJECT_CLASS objectClass = CKO_PUBLIC_KEY;
+    //CK_OBJECT_CLASS objectClass = CKO_CERTIFICATE;
+
+    CK_OBJECT_HANDLE hObject = CK_INVALID_HANDLE;
+    CK_ATTRIBUTE searchAttribute = {CKA_CLASS, &objectClass, sizeof(objectClass)};
+    CK_ULONG ulCount = 0;
+
+    rv = C_FindObjectsInit(hSession, &searchAttribute, 1);
+    qDebug ("C_FindObjectsInit rv = %x",rv);
+    qDebug ("\n");
+    //assert(rv==CKR_OK);
+    if (rv != CKR_OK)
+    {
+        error = returnErrorToQString(rv);
+        qDebug("%s", qPrintable("C_FindObjectsInit: "+error));
+        return list;
+    }
+
+    CK_ULONG objectCount = 3;
+    std::vector<CK_OBJECT_HANDLE> objectHandle(objectCount);
+
+    // se realiza la busqueda
+    //rv = C_FindObjects(hSession, &hObject, 2, &ulCount);
+    rv = C_FindObjects(hSession, objectHandle.data(), objectHandle.size(), &objectCount);
+
+    qDebug ("C_FindObjects rv = %x",rv);
+    qDebug ("\n");
+    //assert(rv==CKR_OK);
+
+    qDebug("*-*-*-*-*getPrivateKeyLabels VALOR DE objectCount %u: ", objectCount);
+    //if (rv != CKR_OK)
+    if ((rv != CKR_OK) )//|| (ulCount == 0))
+    {
+        if (ulCount == 0)
+            qDebug("ulCount == 0");
+
+        error = returnErrorToQString(rv);
+        qDebug(qPrintable("C_FindObjects: "+error));
+        return list;
+
+    }
+
+    rv = C_FindObjectsFinal(hSession);
+    qDebug ("C_FindObjectsFinal rv = %x",rv);
+    qDebug ("\n");
+    //assert(rv==CKR_OK);
+    if (rv != CKR_OK)
+    {
+        error = returnErrorToQString(rv);
+        qDebug(qPrintable("C_FindObjectsFinal: "+error));
+        return list;
+    }
+    objectHandle.resize(objectCount);
+
+    //if (ulCount == 0)
+    if (objectHandle.size() == 0)
+    {
+        qDebug (" \nNinguna clave privada encontrada!\n");
+        // cerrar la sesion
+        /*rv = C_CloseAllSessions(slotID);
+        qDebug("C_CloseAllSessions rv = %x", rv);
+        qDebug ("\n");
+        assert(rv==CKR_OK);*/
+        return list;
+        }
+    else
+    {
+        //qDebug (" \nObjeto encontrado (object=0x%04X)\n", hObject);
+        qDebug("se econtraron %d claves", objectHandle.size());
+        //qDebug (" \nClave privada encontrada:  (clave = 0x%4X)\n", hObject);
+        for (int i=0; i< objectHandle.size(); i++)
+        {
+            qDebug("clave encontrada: 0x%4X", objectHandle[i]);
+        }
+        return list;
+    }
+
+    return list;
+}
 
 // slot para obtener informacion del modulo PKCS11
Index: signHash/cryptotoken.h
===================================================================
--- signHash/cryptotoken.h	(revision f626f58c237e35cbbd3875f861e5cc047dc63313)
+++ signHash/cryptotoken.h	(revision ce57b4529df835ba8d80a34aceea16e66d9bed88)
@@ -3,4 +3,5 @@
 
 #include <QObject>
+#include <QStringList>
 
 #include "pkcs11.h"
@@ -70,9 +71,20 @@
      *
      * @param hashToSign hash to be signed
-     * @param pin pin of cryptographic device
+     * @param pin pin of the cryptographic device
      * @param label label of the private key stored in the cryptographic device
      * @return signed hash
      */
     std::vector<unsigned char> signHash(QString hashToSign, QString pin, QString label);
+
+
+    std::vector<CK_OBJECT_HANDLE> findObject(CK_OBJECT_CLASS objectClass, CK_ULONG max) const;
+
+    /**
+     * @brief Returns a list of key labels
+     *
+     * @param pin pin of the cryptographic device
+     * @return QStringList of labels
+     */
+    QStringList getPrivateKeyLabels(QString pin);
 
     /**
Index: signHash/main.cpp
===================================================================
--- signHash/main.cpp	(revision f626f58c237e35cbbd3875f861e5cc047dc63313)
+++ signHash/main.cpp	(revision ce57b4529df835ba8d80a34aceea16e66d9bed88)
@@ -66,4 +66,7 @@
     assert(ct->toHex(result) == "6cea780ecd21141bfe460d4fd2172f52366c8e357303e9914310f1553951876f2b3d6127571f645b52b8148dfc9f6016e851641ff2c6f785dd84186fe82d802982afd2f88951e22f03dc6982600277a1c18faeda0da89a60d2afb4a51a865bbd4fc3871b8516e8a02afe309b626f8aadb53b6543d99e9c4ab5b334634edcd0898171cb6753b2abe00f64303a1398795e25d64f960ea73041b7178ba539f6bc0cedd16b87f366b4e752fbb7ca4e33fddee8b5adf3bc70f5406a3c69ac8ff62d99ff77a7e340ad6e1d18a7b25e8652653dec5b653a07a8bb289dd6ad9fa876094008864bf475e8589a9cefd2240f2f1f537593e3a94ce01fbea90e9f18bbf3783d");
 
+
+    qDebug("lista de claves privadas:");
+    ct->getPrivateKeyLabels("123456");
 
     //return a.exec();
