Exemplo n.º 1
0
        public KeyOptionsForm(Type cipherType, int IVLength, ModeParams modeParams)
        {
            InitializeComponent();
            _mParams = modeParams;
            _iv = new byte[IVLength];
            tbPassword.Text = _mParams.TextKey;
            tbSeed.Text = _mParams.Seed.ToString();

            //128 (blow, idea, cast, AES)
            if (cipherType.Equals(typeof (BlowfishEngine))  ||  cipherType.Equals(typeof (IdeaEngine)) ||
                cipherType.Equals(typeof (Cast5Engine))     ||  cipherType.Equals(typeof (AesEngine)))
            {
                lbKeyLength.Items.Add(new KeyLengthObject(){Length = 128});
            }
            //56 (DES)
            if (cipherType.Equals(typeof (DesEngine)))
            {
                lbKeyLength.Items.Add(new KeyLengthObject() { Length = 56 });
            }
            //168 (3DES)
            if (cipherType.Equals(typeof (DesEdeEngine)))
            {
                lbKeyLength.Items.Add(new KeyLengthObject(){Length = 168});
            }
            //256 (blow,gost,AES)
            if (cipherType.Equals(typeof (Gost28147Engine)) || cipherType.Equals(typeof (BlowfishEngine)) ||
                cipherType.Equals(typeof (AesEngine)))
            {
                lbKeyLength.Items.Add(new KeyLengthObject(){Length = 256});
            }

            // select first
            lbKeyLength.SelectedIndex = 0;
        }
Exemplo n.º 2
0
        public Criptonator(BlockChiperMode cipherMode)
        {
            InitializeComponent();
            encrypt = new Data100();
            decrypt = new Data100();

            _mParams = new ModeParams();

            this.encodingDict = new Dictionary<string, Encoding>(){
                {Encoding.ASCII.EncodingName, Encoding.ASCII},
                {Encoding.BigEndianUnicode.EncodingName, Encoding.BigEndianUnicode},
                {Encoding.Default.EncodingName, Encoding.Default},
                {Encoding.UTF8.EncodingName, Encoding.UTF8},
                {Encoding.UTF32.EncodingName, Encoding.UTF32},
                {Encoding.Unicode.EncodingName, Encoding.Unicode},
            };

            UpdateChiper(cipherMode);
        }