Sha256: 36df1aa1243d70d6d09129b7bf8da73a3d2218d39e1663a9fe6eaab365430af2
Contents?: true
Size: 1.03 KB
Versions: 1
Compression:
Stored size: 1.03 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}/ } 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.1.0 | lib/setec_astronomy/kee_pass/database.rb |