Porting some code from ruby openssl to java
===

I have the following:


    def from_code(code, secret)
      cipher = OpenSSL::Cipher::BF.new
      cipher.decrypt
      cipher.pkcs5_keyivgen(secret)
      data = cipher.update(Base64.decode64(code + "\n"))
      final = cipher.final
      plaintext = data + final
      plaintext
    end

and my goal is to achieve the exact same using commons.binary and javax.crypto (or whatever other dependency, that's fine), but in Java only. I'm messing around with javax.crypto but thought I would ask here.
Thank you in advance.