예제 #1
0
        private void ProcessSyncEventPkcs11GetKeys(string msg)
        {
            PKCS11Detail d = ManagementParser.getPKCS11ID(msg);

            if (d != null)
            {
                m_pkcs11details.Add(d);

                if (d.Number < m_pkcs11count - 1)
                {
                    m_ovpnComm.send("pkcs11-id-get " + (d.Number + 1));
                }

                else
                {
                    releaseLock();

                    int kid = m_ovpn.getKeyID(m_pkcs11details);

                    if (kid == NeedCardIdEventArgs.Retry)
                    {
                        setLock(WaitState.PKCS11_GET_COUNT);
                        m_ovpnComm.send("pkcs11-id-count");
                    }
                    else if (kid != NeedCardIdEventArgs.None)
                    {
                        m_ovpnComm.send("needstr 'pkcs11-id-request' '" +
                                        m_pkcs11details[kid].Id + "'");
                    }
                }
            }

            // error in parsing
            else
            {
                m_logs.logDebugLine(1,
                                    "Error while parsing pkcs11-id-get: \"" +
                                    msg + "\"");

                releaseLock();
            }
        }
 /// <summary>
 /// generates an event object
 /// </summary>
 /// <param name="details">array of available keys</param>
 internal NeedCardIdEventArgs(PKCS11Detail[] details)
 {
     // save list, select no default key
     m_details = details;
     m_selected = None;
 }