[macruby] #104: Problem with OpenSSL using MacRuby's internal conversion to and from NSData
#104: Problem with OpenSSL using MacRuby's internal conversion to and from NSData --------------------------------+------------------------------------------- Reporter: rich@infoether.com | Owner: lsansonetti@apple.com Type: defect | Status: new Priority: blocker | Milestone: Component: MacRuby | Keywords: --------------------------------+------------------------------------------- This code will reproduce the problem: require 'openssl' require 'digest/sha1' CRYPT = "aes256" password = 'test' gen_key = OpenSSL::Cipher::Cipher.new(CRYPT) gen_key.encrypt key_crypt = OpenSSL::Cipher::Cipher.new(CRYPT) key_crypt.encrypt key_crypt.key = Digest::SHA1.hexdigest(password+CRYPT)[2,32] key = key_crypt.update("KEY_"+OpenSSL::Random.random_bytes(key_crypt.key_len)) key << key_crypt.final #comment out next line and it works File.open("tmp.key", "wb") {|f| f.write(key)} key_decrypt = OpenSSL::Cipher::Cipher.new(CRYPT) key_decrypt.decrypt key_decrypt.key = Digest::SHA1.hexdigest(password+CRYPT)[2,32] db_key = key_decrypt.update(key) db_key << key_decrypt.final If you take out that file write operation, then this code will run. You leave it in and you get block_length error. I believe that has to do with internally converting objects to NSData when treated as binary. It still says the class is NSCFString but something is happening to it. -- Ticket URL: <https://www.macruby.org/trac/ticket/104> macruby <http://macruby.org/>
#104: Problem with OpenSSL using MacRuby's internal conversion to and from NSData --------------------------------+------------------------------------------- Reporter: rich@infoether.com | Owner: lsansonetti@apple.com Type: defect | Status: new Priority: blocker | Milestone: MacRuby 0.3 Component: MacRuby | Resolution: Keywords: | --------------------------------+------------------------------------------- Changes (by lsansonetti@apple.com): * milestone: => MacRuby 0.3 -- Ticket URL: <http://www.macruby.org/trac/ticket/104#comment:1> macruby <http://macruby.org/>
#104: Problem with OpenSSL using MacRuby's internal conversion to and from NSData --------------------------------+------------------------------------------- Reporter: rich@infoether.com | Owner: lsansonetti@apple.com Type: defect | Status: new Priority: blocker | Milestone: MacRuby 0.4 Component: MacRuby | Resolution: Keywords: | --------------------------------+------------------------------------------- Changes (by lsansonetti@apple.com): * milestone: MacRuby 0.3 => MacRuby 0.4 -- Ticket URL: <http://www.macruby.org/trac/ticket/104#comment:2> MacRuby <http://macruby.org/>
#104: Problem with OpenSSL using MacRuby's internal conversion to and from NSData --------------------------------+------------------------------------------- Reporter: rich@… | Owner: lsansonetti@… Type: defect | Status: closed Priority: blocker | Milestone: MacRuby 0.5 Component: MacRuby | Resolution: fixed Keywords: | --------------------------------+------------------------------------------- Changes (by lsansonetti@…): * status: new => closed * resolution: => fixed * milestone: MacRuby 0.4 => MacRuby 0.5 Comment: This seems to work as of r2915. The tmp.key file is properly generated. I don't know if the data is valid though. I'm closing the bug but please re- open it in case something is still not working. -- Ticket URL: <http://www.macruby.org/trac/ticket/104#comment:3> MacRuby <http://macruby.org/>
participants (2)
-
macruby
-
MacRuby