Exemple #1
0
        /// <summary>
        /// Parse input arguments and get the operations list, if no operation is provided all the operations are being performed
        /// </summary>
        /// <returns> the operation list </returns>
        public List <KeyOperationType> GetKeyOperations()
        {
            List <KeyOperationType> keyOperations = new List <KeyOperationType>();

            foreach (var arg in args)
            {
                var result = new KeyOperationType();
                if (Enum.TryParse <KeyOperationType>(arg, true, out result))
                {
                    keyOperations.Add(result);
                }
            }

            // if no operation found use the default
            if (keyOperations.Count == 0)
            {
                Console.Out.WriteLine("No operation is provided. Executing all the key and secret operations!");
                keyOperations.Add(KeyOperationType.CREATE_KEY);
                keyOperations.Add(KeyOperationType.ENCRYPT_ApiKey);
                keyOperations.Add(KeyOperationType.ENCRYPT_Secret);
                keyOperations.Add(KeyOperationType.DECRYPT);
                // keyOperations.Add(KeyOperationType.CREATE_SECRET);
            }
            return(keyOperations);
        }
Exemple #2
0
        /// <summary>
        /// Parse input arguments and get the operations list, if no operation is provided all the operations are being performed
        /// </summary>
        /// <returns> the operation list </returns>
        public List <KeyOperationType> GetKeyOperations()
        {
            List <KeyOperationType> keyOperations = new List <KeyOperationType>();

            foreach (var arg in args)
            {
                var result = new KeyOperationType();
                if (Enum.TryParse <KeyOperationType>(arg, true, out result))
                {
                    keyOperations.Add(result);
                }
            }

            // if no operation found use the default
            if (keyOperations.Count == 0)
            {
                Console.Out.WriteLine("No operation is provided. Executing all the key and secret operations!");
                keyOperations.Add(KeyOperationType.CREATE_KEY);
                keyOperations.Add(KeyOperationType.GET_KEY);
                keyOperations.Add(KeyOperationType.IMPORT_KEY);
                keyOperations.Add(KeyOperationType.BACKUP_RESTORE);
                keyOperations.Add(KeyOperationType.SIGN_VERIFY);
                keyOperations.Add(KeyOperationType.WRAP_UNWRAP);
                keyOperations.Add(KeyOperationType.ENCRYPT_DECRYPT);
                keyOperations.Add(KeyOperationType.UPDATE_KEY);
                keyOperations.Add(KeyOperationType.LIST_KEYVERSIONS);
                keyOperations.Add(KeyOperationType.DELETE_KEY);
                keyOperations.Add(KeyOperationType.CREATE_SECRET);
                keyOperations.Add(KeyOperationType.GET_SECRET);
                keyOperations.Add(KeyOperationType.LIST_SECRETS);
                keyOperations.Add(KeyOperationType.DELETE_SECRET);
            }
            return(keyOperations);
        }
 public void KeyOperation(KeyEventArgs e, KeyOperationType type)
 {
     switch (type)
     {
         case KeyOperationType.KeyDown:
             OnKeyDown(e);
             break;
         case KeyOperationType.KeyUp:
             OnKeyUp(e);
             break;
     }
 }