Bug 1092 fix #1165

Merged
merged 3 commits into from Oct 29, 2013

Projects

None yet

3 participants

@LarsWestergren
Contributor

Behave like MRI - allow for instance UTF8 Strings to PKCS12.create, but coerce them to ASCII_8BIT so BouncyCastle can read them correctly.

@BanzaiMan
Member

See #1092.

@BanzaiMan BanzaiMan commented on an outdated diff Oct 29, 2013
lib/ruby/shared/openssl/pkcs12.rb
@@ -31,6 +31,7 @@ def initialize(str = nil, password = '')
@der = file.read
file.close
else
+ str.force_encoding(Encoding::ASCII_8BIT) unless str.encoding == Encoding::ASCII_8BIT
@BanzaiMan
BanzaiMan Oct 29, 2013 Member

Do we need unless here? Seems to me that if encoding is ASCII_8BIT already, there is no harm in forcing it. (And the code is slightly cleaner as a result.)

@LarsWestergren
Contributor

You are right. Unnecessary conditional removed.

@headius headius merged commit 8bd991d into jruby:master Oct 29, 2013

1 check passed

default The Travis CI build passed
Details
@headius
Member
headius commented Oct 29, 2013

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment