コード例 #1
0
        public EncryptFileOperation(LocalPath source, LocalPath target, RecipientCard recipientCard)
        {
            this.Title = "Encrypt " + source.AsRelativeToRoot();

            this.source        = source;
            this.target        = target;
            this.recipientCard = recipientCard;
        }
コード例 #2
0
 public DecryptWithAnotherPasswordOperation(
     string email,
     PrivateKeyModel privateKeyResponse,
     RecipientCard recipientCard,
     IEventAggregator aggregator)
 {
     this.Email = email;
     this.privateKeyResponse = privateKeyResponse;
     this.recipientCard      = recipientCard;
     this.aggregator         = aggregator;
 }
コード例 #3
0
 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();
 }
コード例 #4
0
        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;
            }
        }
コード例 #5
0
        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);
        }