Пример #1
0
        /// <summary>
        /// Creates a new instance of a specified algorithm-class.
        /// </summary>
        /// <param name="algorithm">The algorithm to use.</param>
        /// <param name="operation">The operations required to be supported.</param>
        /// <returns>Instance of the right algorithm class guaranted to support the given operations (i.e. implementing the correct interfaces).</returns>
        public static AlgorithmBase Create(KeyAlgorithm algorithm, KeyOperation operation)
        {
            Type          type     = Type.GetType("OpenPGP." + algorithm.ToString() + "Algorithm");
            AlgorithmBase instance = (AlgorithmBase)Activator.CreateInstance(type);

            return(instance);
        }
Пример #2
0
        public KeyScrollEnum?TestKey(ConsoleKeyInfo keyInfo)
        {
            KeyOperation item =
                definitions.FirstOrDefault(
                    d => d.Key == keyInfo.Key && d.Control == keyInfo.Modifiers.HasFlag(ConsoleModifiers.Control));

            return((item != null) ? item.Operation : new KeyScrollEnum?());
        }
        public void SupportsOperation(string operationValue, bool supported)
        {
            JsonWebKey jwk = KeyModelFactory.JsonWebKey(KeyType.Ec, curveName: KeyCurveName.P256, keyOps: new[] { KeyOperation.Sign, KeyOperation.Verify });

            EcCryptographyProvider client    = new EcCryptographyProvider(jwk, null);
            KeyOperation           operation = new KeyOperation(operationValue);

            Assert.AreEqual(supported, client.SupportsOperation(operation));
        }
Пример #4
0
        public override bool SupportsOperation(KeyOperation operation)
        {
            if (KeyMaterial != null)
            {
                if (operation == KeyOperation.WrapKey || operation == KeyOperation.UnwrapKey)
                {
                    return(KeyMaterial.SupportsOperation(operation));
                }
            }

            return(false);
        }
        public bool SupportsOperation(KeyOperation operation)
        {
            if (_jwk != null)
            {
                if (operation == KeyOperation.Sign || operation == KeyOperation.Verify)
                {
                    return(_jwk.SupportsOperation(operation));
                }
            }

            return(false);
        }
Пример #6
0
        public bool SupportsOperation(KeyOperation operation)
        {
            if (_jwk != null)
            {
                if (operation == KeyOperation.Encrypt || operation == KeyOperation.Decrypt || operation == KeyOperation.WrapKey || operation == KeyOperation.UnwrapKey)
                {
                    return(_jwk.SupportsOperation(operation));
                }
            }

            return(false);
        }
        public override bool SupportsOperation(KeyOperation operation)
        {
            if (_keyMaterial != null)
            {
                if (operation == KeyOperation.Sign || operation == KeyOperation.Verify)
                {
                    return(_keyMaterial.SupportsOperation(operation));
                }
            }

            return(false);
        }
Пример #8
0
        public string SubmitKey(string key)
        {
            staff         sf  = new StaffHanding().GetStaffMsg(Convert.ToInt64(sc.GetStaffSession()));
            testInfo      ti  = new TestInfoOperation().GetTestInfo(sf.staff_OwnCompanyId)[0];
            List <object> res = new KeyOperation().SubmitKey(key, Convert.ToInt64(sc.GetStaffSession()), ti.testInfo_Id);

            if (res.Contains(1))
            {
                sc.ClearSession();
            }
            return(res.ToJson());
        }
Пример #9
0
        public void SupportsOperation(string operationValue, bool supported)
        {
            JsonWebKey jwk = new JsonWebKey
            {
                CurveName = KeyCurveName.P256,
                KeyOps    = new[] { KeyOperation.Sign, KeyOperation.Verify },
            };

            EcCryptographyProvider client    = new EcCryptographyProvider(jwk);
            KeyOperation           operation = new KeyOperation(operationValue);

            Assert.AreEqual(supported, client.SupportsOperation(operation));
        }
Пример #10
0
        PCInputProvider(MouseOperation mouse, KeyOperation key)
        {
            this.mouse = mouse;
            this.key   = key;

            /***** MouseOperationの操作を監視 *****/
            // 左クリック(押しっぱなしあり)でShot操作発行
            this.mouse.OnLeftClick.Subscribe(_ => onShotSubject.OnNext(true));

            // 左クリック離されも監視
            this.mouse.OnLeftClickUp.Subscribe(_ => onShotSubject.OnNext(false));

            // 右クリック押し→離しで投げ操作発行
            this.mouse.OnRightClickDown.Subscribe(pos => throwBegin = pos);  // 右クリック開始位置を保持
            this.mouse.OnRightClickUp
            .Subscribe(pos =>
            {
                // 右クリック開始→終了位置に応じた角度で投げ操作を発行
                onThrowSubject.OnNext(ThrowAngle(throwBegin, pos));
                throwBegin = Vector2.zero;      // 初期化
            });

            // ホイールクリックでボム操作発行
            this.mouse.OnWheelClickDown.Subscribe(_ => onBombSubject.OnNext(Unit.Default));

            // マウス移動でPlayer移動操作発行
            this.mouse.OnMove.Subscribe(info => onMovePlayerSubject.OnNext(info));

            /***** KeyOperationの操作を監視 *****/
            // スペースキー押しでMenu操作発行
            this.key.OnSpaceKey.Subscribe(_ => onMenuSubject.OnNext(Unit.Default));

            // 左右キー押しで速度変更操作発行
            this.key.OnRightKey.Subscribe(_ => onSpeedEditSubject.OnNext(0.1f));  // 固定で0.1増加
            this.key.OnLeftKey.Subscribe(_ => onSpeedEditSubject.OnNext(-0.1f));  // 固定で0.1減少
        }
Пример #11
0
 public abstract bool SupportsOperation(KeyOperation operation);
 public bool SupportsOperation(KeyOperation operation) => true;
Пример #13
0
        /// <summary>
        /// When the drawingboard issues a key operation, we update our state too
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="keyOperation"></param>
        void OnKeyOperation(object sender, KeyOperation keyOperation)
        {
            switch (keyOperation)
            {
            case KeyOperation.None:
                break;

            case KeyOperation.SelectMode:
                deselectAll();
                SelectBtn.Checked = true;
                break;

            case KeyOperation.DeSelect:
                break;

            case KeyOperation.RectMode:
                deselectAll();
                RectBtn.Checked = true;
                break;

            case KeyOperation.LineMode:
                deselectAll();
                LineBtn.Checked = true;
                break;

            case KeyOperation.EllipseMode:
                deselectAll();
                EllipseBtn.Checked = true;
                break;

            case KeyOperation.RoundRectangleMode:
                deselectAll();
                RRectBtn.Checked = true;
                break;

            case KeyOperation.SimpleTextMode:
                deselectAll();
                break;

            case KeyOperation.RichTextMode:
                deselectAll();
                break;

            case KeyOperation.ImageMode:
                deselectAll();
                ImageBtn.Checked = true;
                break;

            case KeyOperation.AcquireImageMode:
                deselectAll();
                AcquireImageBtn.Checked = true;
                break;

            case KeyOperation.ArcMode:
                deselectAll();
                ArcBtn.Checked = true;
                break;

            case KeyOperation.PolyMode:
                deselectAll();
                PolyBtn.Checked = true;
                break;

            case KeyOperation.PenMode:
                deselectAll();
                CurveBtn.Checked = true;
                break;

            case KeyOperation.Load:
                break;

            case KeyOperation.Save:
                break;

            case KeyOperation.LoadObjects:
                break;

            case KeyOperation.SaveSelectedObjects:
                break;

            case KeyOperation.PrintPreview:
                break;

            case KeyOperation.Print:
                break;

            case KeyOperation.GridOff:
                break;

            case KeyOperation.Grid3:
                break;

            case KeyOperation.Grid5:
                break;

            case KeyOperation.Grid8:
                break;

            case KeyOperation.Grid10:
                break;

            case KeyOperation.Grid12:
                break;

            case KeyOperation.Grid15:
                break;

            case KeyOperation.Grid20:
                break;

            case KeyOperation.GridCustom:
                break;

            case KeyOperation.Undo:
                break;

            case KeyOperation.Redo:
                break;

            case KeyOperation.Group:
                deselectAll();
                GroupBtn.Checked = true;
                break;

            case KeyOperation.UnGroup:
                deselectAll();
                UnGroupBtn.Checked = true;
                break;

            case KeyOperation.PolyMerge:
                break;

            case KeyOperation.PolyDeletePoints:
                break;

            case KeyOperation.PolyExtendPoints:
                break;

            case KeyOperation.PolyMirrorX:
                break;

            case KeyOperation.PolyMirrorY:
                break;

            case KeyOperation.PolyMirrorXY:
                break;

            case KeyOperation.ToFront:
                deselectAll();
                ToFrontBtn.Checked = true;
                break;

            case KeyOperation.ToBack:
                deselectAll();
                ToBackBtn.Checked = true;
                break;

            case KeyOperation.DeleteSelected:
                break;

            case KeyOperation.CopySelected:
                break;

            default:
                throw new ArgumentOutOfRangeException("keyOperation");
            }
        }
Пример #14
0
 /// <summary>
 /// Creates a new instance of a specified algorithm-class.
 /// </summary>
 /// <param name="algorithm">The algorithm to use.</param>
 /// <param name="operation">The operations required to be supported.</param>
 /// <typeparam name="T">The type the instance shall be casted to (can be any AlgorithmBase or any of the interfaces).</typeparam>
 /// <returns>Instance of the right algorithm class guaranted to support the given operations (i.e. implementing the correct interfaces).</returns>
 public static T Create <T>(KeyAlgorithm algorithm, KeyOperation operation) where T : AlgorithmBase, ISign, IValidate, IEncrypt, IDecrypt, IGenerate
 {
     return(Create(algorithm, operation) as T);
 }
Пример #15
0
 public KeyBinding(KeyAction action, Keys key, KeyOperation operation)
 {
     Action = action;
     Key = key;
     Operation = operation;
 }
Пример #16
0
 public KeyEvent( KeyCode key, KeyOperation operationType, BaseEventData eventData)
 {
     keyCode = key;
     this.eventData = eventData;
     this.operationType = operationType;
 }