public void CreateSignature(ApplicationArguments arguments)
        {
            ReadKeyFromFileCommand readPrivateKeyFromFile = fileCommandProvider.GetReadPrivateKeyFromFileCommand(arguments.PrivateKeyPath, arguments.Password);

            commandExecutor.Execute(readPrivateKeyFromFile);

            byte[] contentToSign;
            if (arguments.HasFileInput)
            {
                ReadFileCommand <byte[]> readFileToSign = fileCommandProvider.GetReadFileCommand <byte[]>(arguments.FileInput);
                commandExecutor.Execute(readFileToSign);
                contentToSign = readFileToSign.Result;
            }
            else
            {
                contentToSign = encoding.GetBytes(arguments.Input);
            }

            CreateSignatureCommand createSignature = signatureCommandProvider.GetCreateSignatureCommand(readPrivateKeyFromFile.Result, contentToSign);

            commandExecutor.Execute(createSignature);

            if (arguments.HasFileOutput)
            {
                WriteFileCommand <Signature> writeSignatureTofile = fileCommandProvider.GetWriteToFileCommand(createSignature.Result, arguments.FileOutput);
                commandExecutor.Execute(writeSignatureTofile);
                return;
            }

            WriteToStdOutCommand <Signature> writeSignatureToStdOut = fileCommandProvider.GetWriteToStdOutCommand <Signature>(createSignature.Result);

            commandExecutor.Execute(writeSignatureToStdOut);
        }
        public void CreateKeyPair(ApplicationArguments arguments)
        {
            ICreateAsymmetricKeyCommand createKeyCommand;

            switch (arguments.KeyType)
            {
            case CipherType.Rsa:
                createKeyCommand = keyCommandProvider.GetCreateKeyCommand <RsaKey>(arguments.KeySize);
                break;

            case CipherType.Dsa:
                createKeyCommand = keyCommandProvider.GetCreateKeyCommand <DsaKey>(arguments.KeySize);
                break;

            case CipherType.Ec:
                createKeyCommand = keyCommandProvider.GetCreateKeyCommand <EcKey>(arguments.Curve);
                break;

            case CipherType.ElGamal:
                createKeyCommand = keyCommandProvider.GetCreateKeyCommand <ElGamalKey>(arguments.KeySize, arguments.UseRfc3526Prime);
                break;

            default:
                throw new ArgumentException("Key type not supported.");
            }

            commandExecutor.Execute(createKeyCommand);

            if (createKeyCommand.Curve == "curve25519" && arguments.ContentType == ContentType.OpenSsh)
            {
                WriteFileCommand <IAsymmetricKeyPair> writeOpenSshCurve25519PrivateKey = fileCommandProvider.GetWriteToFileCommand <IAsymmetricKeyPair>(createKeyCommand.Result, arguments.PrivateKeyPath, arguments.ContentType, arguments.EncryptionType, arguments.Password);
                WriteFileCommand <IAsymmetricKey>     writeOpenSshCurve25519PublicKey  = fileCommandProvider.GetWriteKeyToFileCommand(createKeyCommand.Result.PrivateKey, arguments.PublicKeyPath, arguments.ContentType);
                commandExecutor.Execute(writeOpenSshCurve25519PrivateKey);
                commandExecutor.Execute(writeOpenSshCurve25519PublicKey);
                return;
            }

            WriteFileCommand <IAsymmetricKey> writePublicKeyToFile = fileCommandProvider.GetWriteKeyToFileCommand(createKeyCommand.Result.PublicKey, arguments.PublicKeyPath, arguments.ContentType);

            commandExecutor.Execute(writePublicKeyToFile);

            WriteFileCommand <IAsymmetricKey> writePrivateKeyToFile = fileCommandProvider.GetWriteKeyToFileCommand(createKeyCommand.Result.PrivateKey, arguments.PrivateKeyPath, arguments.ContentType, arguments.EncryptionType, arguments.Password);

            commandExecutor.Execute(writePrivateKeyToFile);
        }