Example #1
0
        public override void Terminate()
        {
            menuItemCopyKey.Click   -= MenuItemCopyKey_Click;
            menuItemDeleteKey.Click -= MenuItemDeleteKey_Click;

            host.KeyProviderPool.Remove(symKeyProvider);
            symKeyProvider = null;

            TokenEngine?.Dispose();
            TokenEngine = null;

            host = null;
        }
Example #2
0
        public override bool Initialize(IPluginHost host)
        {
            try
            {
                this.host = host ?? throw new ArgumentNullException("Invalid initialization data.");

                var initResult = TokenEngine.CreateTokenEngineAsync().Result;
                TokenEngine = initResult.Instance;

                host.KeyProviderPool.Add(symKeyProvider = new SymmetricKeyProvider(this));
            }
            catch (Exception e)
            {
                MessageBox.Show($"Failed to initialize plugin." +
                                $"{Environment.NewLine}{Environment.NewLine}Please make sure that the digitronic Token Engine is installed and working properly." +
                                $"{Environment.NewLine}{Environment.NewLine}({e.GetRelevantMessage()})"
                                , "Token Engine Key Provider", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }

            return(true);
        }