keepass

package
v0.0.0-...-06c1dd3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 30, 2023 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EndOfHeader headerField = iota
	Comment
	CipherID
	CompressionFlags
	MasterSeed
	TransformSeed
	TransformRounds
	EncryptionIV
	ProtectedStreamKey
	StreamStartBytes
	InnerRandomStreamID
)

Variables

View Source
var ErrPadding = errors.New("invalid padding")

Functions

func FileKey

func FileKey(path string) ([32]byte, error)

func FindOffset

func FindOffset(g *Group, e *Entry) int

func NewBlockModeReader

func NewBlockModeReader(bm cipher.BlockMode, r io.Reader) io.ReadCloser

func NewBlockModeWriter

func NewBlockModeWriter(bm cipher.BlockMode, w io.Writer) io.WriteCloser

func PasswordKey

func PasswordKey(password []byte) [32]byte

func Protection

func Protection(protectedStreamKey []byte) cipher.Stream

func UpdateProtectedValues

func UpdateProtectedValues(f *File, newProtectedStreamKey [32]byte)

func WriteFile

func WriteFile(w io.Writer, f *File, key Key) error

func WriteOptions

func WriteOptions(w io.Writer, opts Options) error

Types

type AutoTypeOptions

type AutoTypeOptions struct {
	Enabled                 Bool
	DataTransferObfuscation int
	DefaultSequence         string
}

type BinaryField

type BinaryField struct {
	Key   string
	Value BinaryValue
}

type BinaryValue

type BinaryValue struct {
	Protected Bool   `xml:",attr,omitempty"`
	Ref       string `xml:",attr"`
	Value     string `xml:",innerxml"`
}

type Block

type Block struct{}

func (Block) Prefix

func (Block) Prefix(r io.Reader) (n int64, err error)

type Bool

type Bool bool

func (Bool) MarshalXML

func (b Bool) MarshalXML(e *xml.Encoder, start xml.StartElement) error

func (Bool) MarshalXMLAttr

func (b Bool) MarshalXMLAttr(name xml.Name) (xml.Attr, error)

type CompressionAlgorithm

type CompressionAlgorithm uint32
const (
	CompressionAlgorithmNone CompressionAlgorithm = iota
	CompressionAlgorithmGZIP
)

type CustomIcon

type CustomIcon struct {
	UUID []byte
	Data []byte
}

type EncryptionAlgorithm

type EncryptionAlgorithm uint32
const (
	EncryptionNone EncryptionAlgorithm = iota
	EncryptionARC4
	EncryptionSalsa20
)

type Entry

type Entry struct {
	UUID            []byte
	IconID          int
	ForegroundColor string
	BackgroundColor string
	OverrideURL     string
	Tags            string
	Times           EntryTimes
	String          []StringField
	Binary          []BinaryField
	AutoType        AutoTypeOptions
	History         []*HistoricEntry `xml:"History>Entry"`
}

type EntryTimes

type EntryTimes struct {
	LastModificationTime time.Time
	CreationTime         time.Time
	LastAccessTime       time.Time
	ExpiryTime           time.Time
	Expires              Bool
	UsageCount           int
	LocationChanged      time.Time
}

type File

type File struct {
	Header  Header  `xml:"-"`
	Options Options `xml:"-"`
	Meta    Meta
	Root    struct {
		Group          *Group
		DeletedObjects string
	}
}

func NewFile

func NewFile() File

func ReadFile

func ReadFile(f io.Reader, key Key) (File, error)

func (File) Write

func (k File) Write(w io.Writer) error

type Group

type Group struct {
	UUID   []byte
	Name   string
	Notes  string
	IconID int
	Times  struct {
		LastModificationTime time.Time
		CreationTime         time.Time
		LastAccessTime       time.Time
		ExpiryTime           time.Time
		Expires              Bool
		UsageCount           int
		LocationChanged      time.Time
	}
	IsExpanded              Bool
	DefaultAutoTypeSequence string
	EnableAutoType          string
	EnableSearching         string
	LastTopVisibleEntry     string
	Group                   []*Group
	Entry                   []*Entry
}
type Header struct {
	Signatures [2]uint32
	Version    uint32
}

type HistoricEntry

type HistoricEntry struct {
	UUID            []byte
	IconID          int
	ForegroundColor string
	BackgroundColor string
	OverrideURL     string
	Tags            string
	Times           EntryTimes
	String          []StringField
	Binary          []BinaryField
	AutoType        AutoTypeOptions
}

type Key

type Key [32]byte

func CompositeKey

func CompositeKey(keys ...[32]byte) Key

func (Key) Transform

func (k Key) Transform(seed []byte, rounds int) ([]byte, error)

type Meta

type Meta struct {
	Generator                  string
	HeaderHash                 []byte
	DatabaseName               string
	DatabaseNameChanged        time.Time
	DatabaseDescription        string
	DatabaseDescriptionChanged time.Time
	DefaultUserName            string
	DefaultUserNameChanged     time.Time
	MaintenanceHistoryDays     int
	Color                      string
	MasterKeyChanged           time.Time
	MasterKeyChangeRec         int
	MasterKeyChangedForce      int
	MemoryProtection           struct {
		ProtectTitle    Bool
		ProtectUserName Bool
		ProtectPassword Bool
		ProtectURL      Bool
		ProtectNotes    Bool
	}
	CustomIcons                []CustomIcon
	RecycleBinEnabled          Bool
	RecycleBinUUID             []byte
	RecycleBinChanged          time.Time
	EntryTemplatesGroup        []byte
	EntryTemplatesGroupChanged time.Time
	LastSelectedGroup          []byte
	LastTopVisibleGroup        []byte
	HistoryMaxItems            int
	HistoryMaxSize             int
	Binaries                   string
	CustomData                 string
}

type Options

type Options struct {
	Cipher uuid.UUID
	CompressionAlgorithm
	MasterSeed          [32]byte
	TransformSeed       [32]byte
	TransformRounds     int64
	EncryptionIV        [16]byte
	ProtectedStreamKey  [32]byte
	StreamStartBytes    [32]byte
	InnerRandomStreamID EncryptionAlgorithm
}

func ReadOptions

func ReadOptions(f io.Reader) (Options, error)

type PrefixReader

type PrefixReader struct {
	Reader   io.Reader
	Prefixer interface {
		Prefix(r io.Reader) (n int64, err error)
	}
	// contains filtered or unexported fields
}

func (*PrefixReader) Read

func (r *PrefixReader) Read(p []byte) (n int, err error)

type PrefixWriter

type PrefixWriter struct {
	// contains filtered or unexported fields
}

func (*PrefixWriter) Write

func (w *PrefixWriter) Write(p []byte) (n int, err error)

type StringField

type StringField struct {
	Key   string
	Value StringValue
}

type StringValue

type StringValue struct {
	Protected Bool   `xml:",attr,omitempty"`
	Value     string `xml:",innerxml"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL