public EncryptFileOperation(LocalPath source, LocalPath target, RecipientCard recipientCard) { this.Title = "Encrypt " + source.AsRelativeToRoot(); this.source = source; this.target = target; this.recipientCard = recipientCard; }
public DecryptWithAnotherPasswordOperation( string email, PrivateKeyModel privateKeyResponse, RecipientCard recipientCard, IEventAggregator aggregator) { this.Email = email; this.privateKeyResponse = privateKeyResponse; this.recipientCard = recipientCard; this.aggregator = aggregator; }
public ParcelModel() { ParcelList = new List <TableItem>(); MessageList = new List <Message>(); TrackEventList = new List <TrackEvent>(); Parcel = new ParcelCard(); Sender = new SenderCard(); Recipient = new RecipientCard(); Payment = new PaymentCard(); Delivery = new DeliveryCard(); }
private async void SelectKey(object arg) { try { this.ClearErrors(); this.IsBusy = true; var fileDto = this.SelectedCard; if (this.SelectedCard == null) { this.RaiseErrorMessage("Please select card"); return; } var cardDto = await SDK.Domain.ServiceLocator.Services.Cards.Get(fileDto.card.id); var recipientCard = new RecipientCard(cardDto); var personalCard = new PersonalCard(recipientCard, new PrivateKey(fileDto.private_key)); if (personalCard.IsPrivateKeyEncrypted && !personalCard.CheckPrivateKeyPassword(this.Password)) { throw new WrongPrivateKeyPasswordException("Wrong password"); } try { var encrypt = personalCard.Encrypt("test"); personalCard.Decrypt(encrypt, this.Password); } catch { throw new Exception("Virgil card is malformed"); } this.aggregator.Publish(new CardLoaded(personalCard, this.Password)); this.aggregator.Publish(new ConfirmationSuccessfull()); } catch (WrongPrivateKeyPasswordException e) { this.AddErrorFor(nameof(this.Password), e.Message); } catch (Exception e) { this.RaiseErrorMessage(e.Message); } finally { this.IsBusy = false; } }
public async Task Initiate(string email, string password) { this.email = email.Trim().ToLowerInvariant(); this.password = password; var search = await Cards.Search(this.email); if (search.Count == 0) { throw new VirgilException("Account doesn't exist"); } this.recipientCard = search .OrderByDescending(it => it.CreatedAt) .FirstOrDefault(); this.state = States.CardFound; this.request = await Identity.Verify(this.email); }