0

I have database with quite big amount of records each contains keys encrypted with AES-256. On one side of project it is encoded/decoded by Ruby's Gibberlish module like following:

require 'Gibberish'

data = "piter"
data_enc = 'U2FsdGVkX1+SqREvs/5j8LiPssIg6TbZNlvrChcz7fw='
password = 'p4ssw0rd'

cipher = Gibberish::AES.new(password)
puts cipher.enc(data)

puts cipher.dec(data_enc)

#Here is it somehow base64-encoded, I do not know how

As you can see no key of IV used. As I understand it is derived from password somehow. But tracing Gibberlish and OpenSSL source follows me to the method, makes key and IV, which is called from binary library.

On another (my) side of project encryption performed by python but it is just make a pipe to system native openssl like:

echo somedata | openssl enc -aes-256-cbc -a -e -pass pass:p4ssw0rd

It is very slow (and called often) so now I want to replace it with aespython or PyCrypto. Unfortunately I do not know how to perform it using only password I know, because both this modules are require key and IV.

I have only one requirement: data encrypted on python's side must be decryptable by openssl call I put some lines above and Ruby's Gibberlish module (i.e. Ruby's OpenSSL::Cipher module) with only password.

How could I achieve it?

Alex G.P.
  • 9,609
  • 6
  • 46
  • 81

0 Answers0