private void GenerateKeypair(int size) { GenerateKeysButton.Enabled = false; Task.Run(AnimateGeneratingText); SetRSAParameters(MicrosoftRSA.GenerateKeyPair(size)); GenerateKeysButton.Enabled = true; }
private IBlockCipher GetBlockCipher(MicrosoftRSA rsa) { BigInteger?initializationVector = GetInitializationVector(); return(initializationVector.HasValue ? new CipherBlockChaining(rsa, initializationVector.Value) : GetBlockCipherWithoutInitializationVector(rsa)); }
private ImageBlockCipher GetImageBlockCipher(RSAParameters parameters) { MicrosoftRSA rsa = new MicrosoftRSA(parameters); IBlockCipher blockCipher = GetBlockCipher(rsa); ImageBlockCipher imageBlockCipher = new ImageBlockCipher(blockCipher); return(imageBlockCipher); }
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(); } }