From: William H. <wg...@gm...> - 2009-08-14 00:03:37
|
Hi All, I can't seem to figure out how to do the exact same thing occurring in the following ruby code via the openssl command line or python code: #!/usr/bin/ruby require 'base64' require 'openssl' decrypted_key = File.read('decrypted_key1.txt') encrypted_tkt = File.read('encrypted_ticket.txt') cipher = OpenSSL::Cipher::Cipher.new( 'AES-128-CBC' ) cipher.decrypt cipher.key = decrypted_key cipher.padding = 0 ciphertext = Base64::decode64( encrypted_tkt ) cipher.iv = ciphertext[0,cipher.iv_len] ciphertext = ciphertext[cipher.iv_len..-1] @decrypted_ticket = cipher.update( ciphertext ) + cipher.final # number of padding bytes at the end of the cleartext is recorded in the last byte last_byte = @decrypted_ticket[-1] @decrypted_ticket = @decrypted_ticket[0..-last_byte-1] # decrypted value is itself an xml document print @decrypted_ticket I tried this; openssl enc -d -aes-128-cbc -a -in cipher2.txt -pass file:decrypted_key1.txt This did not work, any ideas? -Tim |