Beispiel #1
0
 private void GenerateKeypair(int size)
 {
     GenerateKeysButton.Enabled = false;
     Task.Run(AnimateGeneratingText);
     SetRSAParameters(MicrosoftRSA.GenerateKeyPair(size));
     GenerateKeysButton.Enabled = true;
 }
Beispiel #2
0
        private IBlockCipher GetBlockCipher(MicrosoftRSA rsa)
        {
            BigInteger?initializationVector = GetInitializationVector();

            return(initializationVector.HasValue
                ? new CipherBlockChaining(rsa, initializationVector.Value)
                : GetBlockCipherWithoutInitializationVector(rsa));
        }
Beispiel #3
0
        private ImageBlockCipher GetImageBlockCipher(RSAParameters parameters)
        {
            MicrosoftRSA     rsa              = new MicrosoftRSA(parameters);
            IBlockCipher     blockCipher      = GetBlockCipher(rsa);
            ImageBlockCipher imageBlockCipher = new ImageBlockCipher(blockCipher);

            return(imageBlockCipher);
        }
Beispiel #4
0
        private IBlockCipher GetBlockCipherWithoutInitializationVector(MicrosoftRSA rsa)
        {
            switch (blockCipherMethod)
            {
            case BlockCipherMethod.ElectronicCodebook:
                return(new ElectronicCodebook(rsa));

            case BlockCipherMethod.CipherBlockChaining:
                var cbc = new CipherBlockChaining(rsa);
                InitializationVectorTextBox.Text = cbc.InitializationVector.ToString();
                return(cbc);

            default:
                throw new ArgumentOutOfRangeException();
            }
        }