Sha256: 6f71206f0ef89707f269f62aafb0456a780d0ac1d5f8daa338db65a1aa8b6ea9
Contents?: true
Size: 1.04 KB
Versions: 1
Compression:
Stored size: 1.04 KB
Contents
module SetecAstronomy module KeePass class Database attr_reader :header, :groups, :entries def self.open(path) self.new(File.read(path)) end def initialize(raw_db) @header = Header.new(raw_db[0..124]) @encrypted_payload = raw_db[124..-1] end def entry(title) @entries.detect { |e| e.title == title } end def unlock(master_password) @final_key = header.final_key(master_password) decrypt_payload payload_io = StringIO.new(@payload) @groups = Group.extract_from_payload(header, payload_io) @entries = Entry.extract_from_payload(header, payload_io) true rescue OpenSSL::Cipher::CipherError false end def search(pattern) entries.select { |e| e.title =~ /#{pattern}/i } end def valid? @header.valid? end def decrypt_payload @payload = AESCrypt.decrypt(@encrypted_payload, @final_key, header.encryption_iv, 'AES-256-CBC') end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
setec_astronomy-0.2.0 | lib/setec_astronomy/kee_pass/database.rb |