public Command Initialize(string[] args) { if (args.Length == 4) { fileService = new FileService(); consoleUtils = new ConsoleUtils(); Console.WriteLine("You need a passphrase to unlock a private key."); Console.Write("Enter a passphrase: "); privateKey = fileService.GetPrivateKeyFromFile(args[1], consoleUtils.GetPassword()); if (File.Exists(args[2])) { cipherData = File.ReadAllBytes(args[2]); } else { throw new ArgumentException(); } pathToDecryptedData = args[3]; rsaes_oaep = new RSAES_OAEP(); hash = new SHA512CryptoServiceProvider(); initialized = true; return(this); } else { throw new ArgumentException(); } }
public Command Initialize(string[] args) { if (args.Length == 4) { try { fileService = new FileService(); publicKey = fileService.GetPublicKeyFromFile(args[1]); if (File.Exists(args[2])) { plainText = File.ReadAllBytes(args[2]); } else { throw new ArgumentException(); } pathToCipherText = args[3]; rsaes_oaep = new RSAES_OAEP(); hash = new SHA512CryptoServiceProvider(); initialized = true; return(this); } catch (Exception) { throw new ArgumentException(); } } else { throw new ArgumentException(); } }
public void setUp() { oaep = new RSAES_OAEP(); hash = new SHA512CryptoServiceProvider(); keyGenerator = new KeyGenerator(); }