diff options
author | Kazuki Yamaguchi <k@rhe.jp> | 2017-12-14 18:47:22 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-14 18:47:22 +0900 |
commit | ffb5367567e7dadd684a63f751f34b3de296f7bb (patch) | |
tree | c833dd245ee2595692a5665207e7f6f2668b8d9e /lib/openssl | |
parent | 538aec722185457173a7cbf9fcae5a3a1de177b1 (diff) | |
parent | 60ce7ea71f6de7ada86ca809b5418afa8230f891 (diff) | |
download | ruby-openssl-ffb5367567e7dadd684a63f751f34b3de296f7bb.tar.gz |
Merge pull request #177 from rhenium/ky/pkey-ec-point-octet-string
pkey/ec: add support for octet string encoding of EC point
Diffstat (limited to 'lib/openssl')
-rw-r--r-- | lib/openssl/pkey.rb | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/lib/openssl/pkey.rb b/lib/openssl/pkey.rb index dcedd849..8a547c34 100644 --- a/lib/openssl/pkey.rb +++ b/lib/openssl/pkey.rb @@ -1,3 +1,25 @@ # frozen_string_literal: false -module OpenSSL +#-- +# Ruby/OpenSSL Project +# Copyright (C) 2017 Ruby/OpenSSL Project Authors +#++ + +module OpenSSL::PKey + if defined?(EC) + class EC::Point + # :call-seq: + # point.to_bn([conversion_form]) -> OpenSSL::BN + # + # Returns the octet string representation of the EC point as an instance of + # OpenSSL::BN. + # + # If _conversion_form_ is not given, the _point_conversion_form_ attribute + # set to the group is used. + # + # See #to_octet_string for more information. + def to_bn(conversion_form = group.point_conversion_form) + OpenSSL::BN.new(to_octet_string(conversion_form), 2) + end + end + end end |