Exemplo n.º 1
0
        private PasswordEntry GetLithnetCurrentPassword(IComputer computer, DateTime?newExpiry)
        {
            var item = this.lithnetProvider.GetCurrentPassword(computer, newExpiry);

            if (item == null)
            {
                return(null);
            }

            PasswordEntry current = new PasswordEntry()
            {
                Created    = item.Created,
                Password   = this.encryptionProvider.Decrypt(item.EncryptedData, (thumbprint) => this.certificateProvider.FindDecryptionCertificate(thumbprint, Constants.ServiceName)),
                ExpiryDate = newExpiry ?? this.lithnetProvider.GetExpiry(computer)
            };

            return(current);
        }
Exemplo n.º 2
0
        private IList <PasswordEntry> GetPasswordHistoryEntries(IComputer computer)
        {
            List <PasswordEntry> list = new List <PasswordEntry>();

            foreach (var item in this.lithnetProvider.GetPasswordHistory(computer))
            {
                PasswordEntry p = new PasswordEntry()
                {
                    Created    = item.Created,
                    Password   = this.encryptionProvider.Decrypt(item.EncryptedData, (thumbprint) => this.certificateProvider.FindDecryptionCertificate(thumbprint, Constants.ServiceName)),
                    ExpiryDate = item.Retired
                };

                list.Add(p);
            }

            if (list.Count == 0)
            {
                throw new NoPasswordException();
            }

            return(list);
        }