Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenSSL::Cipher::CipherError wrong final block length #3

Open
jorgevbo opened this issue Jul 25, 2012 · 2 comments
Open

OpenSSL::Cipher::CipherError wrong final block length #3

jorgevbo opened this issue Jul 25, 2012 · 2 comments

Comments

@jorgevbo
Copy link

OpenSSL::Cipher::CipherError in MigrateController#index

wrong final block length

I am using default configuration and files with UTF-8 encoding

@sbfaulkner
Copy link
Member

are you still having this issue? is it easily reproducible?

@jorgevbo
Copy link
Author

jorgevbo commented Sep 4, 2012

Hi, @sbfaulkner
The problem occurs when I encrypt files with UTF-8 encoding. The file where I use Encryptor has "# encoding: UTF-8" on first line.

content = File.open(path, "r") { |f| f.read }
return Encryptor.encrypt(:value => content, :key => @securekey)

To avoid the problem, now I'm using "rb" attribute to read files like binary.
content = File.open(path, "rb") { |f| f.read }
return Encryptor.encrypt(:value => content, :key => @securekey)

Another particular problem I've had is when using JRuby.
From Ruby encrypted file to JRuby, It's decrypt successfully.
From JRuby encrypted file to Ruby, It has different exceptions (bad encrypt, length size, etc.), but I think is because a bad implementation of JCE from part of JRuby gems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants