# \[Ruby-Feature#3902\]\[Open\] Integer#to\_bn in OpenSSL

**URL:** <https://www.ruby-forum.com/t/ruby-feature-3902-open-integer-to-bn-in-openssl/195951>\
**Category:** Development\
**Created:** [October 3, 2010, 9:19pm UTC](https://www.ruby-forum.com/t/ruby-feature-3902-open-integer-to-bn-in-openssl/195951 "2010-10-03T21:19:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ippei\_Obayashi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/ee7513/32.png) [@Ippei\_Obayashi](https://www.ruby-forum.com/u/Ippei_Obayashi)\
**Post date:** [October 3, 2010, 9:19pm UTC](https://www.ruby-forum.com/t/ruby-feature-3902-open-integer-to-bn-in-openssl/195951/1 "2010-10-03T21:19:42Z")

</div>

Feature #3902: Integer#to\_bn in OpenSSL  
[http://redmine.ruby-lang.org/issues/show/3902](http://redmine.ruby-lang.org/issues/show/3902)

e$B5/I\<\<Te(B: Ippei Obayashi  
e$B%9%F!\<%?%9e(B: Open, e$BM%@hEYe(B: Normal  
e$B%+%F%4%je(B: ext

ext/openssl e$B$GDj5A$5$l$F$$$ke(B Integer#to\_bn  
e$B$,0J2\<$N$h$&$K@5$7$/F0:n$7$^$;$s!#e(B  
% ruby-1.9.2-p0 -v  
ruby 1.9.2p0 (2010-08-18 revision 29036) [x86\_64-linux]  
% ruby-1.9.2-p0 -ropenssl -e ‘43.to\_bn’  
/home/ohai/opt/ruby-1.9.2-p0/lib/ruby/1.9.1/openssl/bn.rb:32:in  
`initialize': can't convert Fixnum into String (TypeError) from /home/ohai/opt/ruby-1.9.2-p0/lib/ruby/1.9.1/openssl/bn.rb:32:in `new’  
from /home/ohai/opt/ruby-1.9.2-p0/lib/ruby/1.9.1/openssl/bn.rb:32:in  
`to_bn' from -e:1:in `’

e$B0J2\<$N=$@5$GD\>$k$H;W$$$^$9!#e(B  
— a/ext/openssl/lib/openssl/bn.rb  
+++ b/ext/openssl/lib/openssl/bn.rb  
@@ -29,7 +29,7 @@ end # OpenSSL

# 

class Integer  
def to\_bn

- OpenSSL::BN::new(self)

- OpenSSL::BN::new(self.to\_s)  
end  
end # Integer

---

<div class="post-metadata">

**Author:** ![Ippei\_Obayashi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/ee7513/32.png) [@Ippei\_Obayashi](https://www.ruby-forum.com/u/Ippei_Obayashi)\
**Post date:** [October 4, 2010, 3:31am UTC](https://www.ruby-forum.com/t/ruby-feature-3902-open-integer-to-bn-in-openssl/195951/2 "2010-10-04T03:31:50Z")

</div>

e$B%A%1%C%He(B #3902 e$B$,99?7$5$l$^$7$?!#e(B (by Yui NARUSE)

e$B%9%F!\<%?%9e(B Opene$B$+$ie(BClosede$B$KJQ99e(B

## r29407e$B$G=$@5$7$^$7$?e(B

[http://redmine.ruby-lang.org/issues/show/3902](http://redmine.ruby-lang.org/issues/show/3902)
