public SignerDocumentController(ILogger <SignerDocumentController> logger, IDigiSignRepository repo, AuthHelper authHelper, IHostingEnvironment _hostingEnvironment, IConfiguration config, IMailService mailService, IOptions <AppConfiguration> appConfig, SignerHelper signerHelper) { _logger = logger; _repository = repo; _authHelper = authHelper; _authHelper.initRepo(repo); _app = new App(_hostingEnvironment); _signerHelper = signerHelper; _signerHelper.initRepo(authHelper, repo); _commonHelper = new CommonHelper(config); _mailService = mailService; _appConfig = appConfig.Value; }
CertRequestContext InitializeRequestContext(RequestNewCertificateOptions options) { var context = new CertRequestContext(); try { context.Registration = RegistrationHelper.LoadFromFile(options.RegisterationFile); }catch (Exception ex) { ConsoleErrorOutput($"Could not load registration file: {ex.Message}"); goto errorHandling; } try { context.Signer = SignerHelper.LoadFromFile(options.SignerFile); } catch (Exception ex) { ConsoleErrorOutput($"Could not load signer file: {ex.Message}"); goto errorHandling; } try { var dnsProviderType = AllSupportedDnsProviderTypes[options.DnsProviderName]; context.DnsProvider = Activator.CreateInstance(dnsProviderType) as IDnsProvider; context.DnsProvider.Initialize(options.DnsProviderConfiguration ?? string.Empty); } catch (Exception ex) { ConsoleErrorOutput($"Could not initialize dns provider: {ex.Message}"); goto errorHandling; } return(context); errorHandling: return(null); }
private async Task Sign() { try { await SignerHelper.Sign(this.request); await Navigation.PopAsync(); tcs.SetResult(true); } catch (DigitalSignatureError e) { ShowMessage(e.Message); } catch (TaskCanceledException) { ShowMessage(AppResources.SIGNATURE_CANCELLED); } catch (Exception e) { //TODO: log this unexpected error ShowMessage(e.Message); } }