Click here to Skip to main content
11,412,302 members (63,062 online)
Click here to Skip to main content
Articles » Languages » C# » General » Downloads
Add your own
alternative version

Password Safe Database Reader Library in C# for .NET

, 16 Oct 2007 GPL3
An independent library implementation to read Password Safe Password Manager V3 database files
#region License
/*
 *  PasswordSafe Database Reader/Writer
 *
 *  Copyright (C) 2007 Svante Seleborg
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 * 
 *  If you'd like to license this program under any other terms than the
 *  above, please contact the author and copyright holder.
 *
 *  Contact: mailto:svante@axantum.com
 */
#endregion

using System;

namespace Axantum.PasswordSafe
{
    /// <summary>
    /// A database password record
    /// </summary>
    public class PasswordSafeRecord : PasswordSafeRecordBase
    {
        private Guid _uuid;

        /// <summary>
        /// Gets or sets the UUID (GUID) used for synchronization etc
        /// </summary>
        /// <value>The UUID.</value>
        public Guid Uuid
        {
            get { return _uuid; }
            set { _uuid = value; }
        }

        private string _group;

        /// <summary>
        /// Gets or sets the group.
        /// </summary>
        /// <value>The group.</value>
        public string Group
        {
            get { return _group; }
            set { _group = value; }
        }

        private string _title;

        /// <summary>
        /// Gets or sets the title.
        /// </summary>
        /// <value>The title.</value>
        public string Title
        {
            get { return _title; }
            set { _title = value; }
        }

        private string _user;

        /// <summary>
        /// Gets or sets the user.
        /// </summary>
        /// <value>The user.</value>
        public string User
        {
            get { return _user; }
            set { _user = value; }
        }

        private string _notes;

        /// <summary>
        /// Gets or sets the notes.
        /// </summary>
        /// <value>The notes.</value>
        public string Notes
        {
            get { return _notes; }
            set { _notes = value; }
        }

        private string _passwordValue = String.Empty;

        /// <summary>
        /// Gets or sets the password value. Don't use this to get the passord, use the Password property.
        /// </summary>
        /// <value>The password value.</value>
        internal string PasswordValue
        {
            get { return _passwordValue; }
            set { _passwordValue = value; }
        }

        private DateTime _timeRecordCreatedUtc = DateTime.MinValue;

        /// <summary>
        /// Gets or sets the time the record was created.
        /// </summary>
        /// <value>The time record created.</value>
        public DateTime TimeRecordCreatedUtc
        {
            get { return _timeRecordCreatedUtc; }
            set { _timeRecordCreatedUtc = value; }
        }

        private DateTime _timeRecordAccessedUtc = DateTime.MinValue;

        /// <summary>
        /// Gets or sets the time the record was accessed (UTC).
        /// </summary>
        /// <value>The date and time</value>
        public DateTime TimeRecordAccessedUtc
        {
            get { return _timeRecordAccessedUtc; }
            set { _timeRecordAccessedUtc = value; }
        }

        private DateTime _timeRecordModifiedUtc = DateTime.MinValue;

        /// <summary>
        /// Gets or sets the time the record was modified (UTC).
        /// </summary>
        /// <value>The date and time</value>
        public DateTime TimeRecordModifiedUtc
        {
            get { return _timeRecordModifiedUtc; }
            set { _timeRecordModifiedUtc = value; }
        }

        private DateTime _timePasswordExpiresUtc = DateTime.MaxValue;

        /// <summary>
        /// Gets or sets the time the password expires (UTC). (Use the 'Password' property)
        /// </summary>
        /// <value>The date and time</value>
        internal DateTime TimePasswordExpiresUtc
        {
            get { return _timePasswordExpiresUtc; }
            set { _timePasswordExpiresUtc = value; }
        }

        private DateTime _timePasswordModifiedUtc = DateTime.MinValue;

        /// <summary>
        /// Gets or sets the time the password was modified (UTC). (Use the 'Password' property)
        /// </summary>
        /// <value>The date and time</value>
        internal DateTime TimePasswordModifiedUtc
        {
            get { return _timePasswordModifiedUtc; }
            set { _timePasswordModifiedUtc = value; }
        }

        /// <summary>
        /// Gets the password.
        /// </summary>
        /// <value>The password.</value>
        public PasswordSafePassword Password
        {
            get
            {
                return new PasswordSafePassword(PasswordValue, TimePasswordModifiedUtc, TimePasswordExpiresUtc);
            }
        }

        private string _resourceLocator;

        /// <summary>
        /// Gets or sets the URL.
        /// </summary>
        /// <value>The URL.</value>
        public string ResourceLocator
        {
            get { return _resourceLocator; }
            set { _resourceLocator = value; }
        }

        private string _autoType;

        /// <summary>
        /// Gets or sets the auto-type string. [Not sure if this is really a good idea, it sounds to me like
        /// a vulnerability vector...] You may want to be careful about using the contents.
        /// </summary>
        /// <value>The string to automatically type</value>
        public string AutoType
        {
            get { return _autoType; }
            set { _autoType = value; }
        }

        private PasswordSafePasswordHistory _passwordHistory;

        /// <summary>
        /// Gets or sets the password history.
        /// </summary>
        /// <value>The password history.</value>
        public PasswordSafePasswordHistory PasswordHistory
        {
            get { return _passwordHistory; }
            set { _passwordHistory = value; }
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The GNU General Public License (GPLv3)

Share

About the Author

Svante Seleborg
Web Developer Axantum Software AB
Sweden Sweden
I've been working with all aspects of software development since 1979 - from compiler construction to management. Currently I'm an independent consultant mostly specializing in computer security. Please see my homepage for contact details.

I speak C like a native, and have a pretty good grasp of C++. The most recent five years C# has been the main development language. Traditionally Unix has been the dominating environment, but currently the scales have tipped over to Windows, due to market demands but I'm equally at home developing in both environments.

When I'm not coding I'm usually sitting on one of my 4 bikes, indoors or outdoors, on the road or in the woods.

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.150414.5 | Last Updated 16 Oct 2007
Article Copyright 2007 by Svante Seleborg
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid