Sha256: 5f873b49b8797b073b6a7a087995350ec5dc5b4e9247aeb0cb77291a5e5def7d
Contents?: true
Size: 1.11 KB
Versions: 1
Compression:
Stored size: 1.11 KB
Contents
module SetecAstronomy module KeePass class Database attr_reader :header, :groups, :entries def self.open(path) content = File.respond_to?(:binread) ? File.binread(path) : File.read(path) self.new(content) 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.1 | lib/setec_astronomy/kee_pass/database.rb |