/// <summary>
        /// we need a key id, raise an event to fetch it
        /// </summary>
        /// <param name="pkcs11d">available keys</param>
        /// <returns>id of the key to use</returns>
        internal int getKeyID(List <PKCS11Detail> pkcs11d)
        {
            if (NoEvents)
            {
                return(NeedCardIdEventArgs.None);
            }

            m_logs.logDebugLine(1, "Asking user for PKCS11 Token");
            NeedCardIdEventArgs args =
                new NeedCardIdEventArgs(pkcs11d.ToArray());

            if (NeedCardId != null)
            {
                NeedCardId(this, args);
            }
            return(args.SelectedId);
        }
        /// <summary>
        /// we need a key id, raise an event to fetch it
        /// </summary>
        /// <param name="pkcs11d">available keys</param>
        /// <returns>id of the key to use</returns>
        internal int getKeyID(List<PKCS11Detail> pkcs11d)
        {
            if (NoEvents) 
                return NeedCardIdEventArgs.None;

            m_logs.logDebugLine(1, "Asking user for PKCS11 Token");
            NeedCardIdEventArgs args = 
                new NeedCardIdEventArgs(pkcs11d.ToArray());

            if(NeedCardId != null)
                NeedCardId(this, args);
            return args.SelectedId;
        }
        /// <summary>
        /// OVPN requests a SmardCard id <br />
        /// generates and shows a form, answers via e
        /// </summary>
        /// <param name="sender">OVPN which requests the id</param>
        /// <param name="e">Information, what was found</param>
        private void m_vpn_needCardID(object sender, NeedCardIdEventArgs e)
        {
            // if there is no id
            if (e.CardDetails.Count == 0)
            {
                if (RTLMessageBox.Show(m_parent,
                    Program.res.GetString("BOX_NoKey"),
                    MessageBoxButtons.RetryCancel,
                    MessageBoxDefaultButton.Button1,
                    MessageBoxIcon.Warning) == DialogResult.Retry)

                    e.SelectedId = NeedCardIdEventArgs.Retry;
                else
                {
                    e.SelectedId = NeedCardIdEventArgs.None;
                    m_disconnectTimer.Start();

                }
            }

            // if there is only one id, use it
            else if (e.CardDetails.Count == 1)
                e.SelectedId = e.CardDetails[0].Number;
            else
            {
                // request key
                m_frmkey = new FrmSelectPKCS11Key();
                int res = m_frmkey.SelectKey(e.CardDetails, this.Name);
                if (res == -1)
                {
                    e.SelectedId = NeedCardIdEventArgs.None;
                    if (VPNConnection.State.CreateSnapshot().ConnectionState
                        == VPNConnectionState.Initializing)
                    {
                        m_disconnectTimer.Start();
                    }
                }
                else if (res == -2)
                    e.SelectedId = NeedCardIdEventArgs.Retry;
                else
                    e.SelectedId = res;
                m_frmkey = null;
            }
        }