register_services (Net::SSH::Transport::OSSL)

    # File lib/net/ssh/transport/ossl/services.rb, line 25
            def register_services( container )
              # make sure the user has a valid Ruby and OpenSSL installed.
              version_check

              # Register all OpenSSL services in the :ossl namespace.
              container.namespace_define :ossl do |b|

                # The list of known sources of HMAC algorithm implementations.
                b.hmac_algorithm_sources { Array.new }
                b.require 'net/ssh/transport/ossl/hmac/services', "#{self}::HMAC"

                # The hash mapping SSH2 cipher names to OpenSSL cipher names.
                b.cipher_names do
                  Hash[ "3des-cbc"     => "des-ede3-cbc",
                        "blowfish-cbc" => "bf-cbc",
                        "aes256-cbc"   => "aes-256-cbc",
                        "aes192-cbc"   => "aes-192-cbc",
                        "aes128-cbc"   => "aes-128-cbc",
                        "idea-cbc"     => "idea-cbc",
                        "none"         => "none" ]
                end

                # The hash mapping key names to OpenSSL key implementations.
                b.key_names do
                  Hash[ "dh"  => OpenSSL::PKey::DH,
                        "rsa" => OpenSSL::PKey::RSA,
                        "dsa" => OpenSSL::PKey::DSA ]
                end

                # The hash mapping digest names to OpenSSL digest implementations.
                b.digest_names do
                  Hash[ "sha1" => OpenSSL::Digest::SHA1,
                        "md5"  => OpenSSL::Digest::MD5 ]
                end

                # The factory for converting cipher names to cipher implementations.
                b.cipher_factory( :model => :singleton_deferred ) do |c,p|
                  require 'net/ssh/transport/ossl/cipher-factory'
                  svc = CipherFactory.new( c.cipher_names )
                  svc.identity_cipher = c.identity_cipher
                  svc
                end

                # The factory for converting HMAC names to HMAC implementations.
                b.hmac_factory( :model => :singleton_deferred ) do |c,p|
                  require 'net/ssh/transport/ossl/hmac-factory'
                  HMACFactory.new( c.hmac_algorithm_sources )
                end

                # The factory for obtaining OpenSSL-specific buffer implementations.
                b.buffer_factory do
                  require 'net/ssh/transport/ossl/buffer-factory'
                  BufferFactory.new
                end

                # The factory for converting key names to key implementations.
                b.key_factory( :model => :singleton_deferred ) do |c,p|
                  require 'net/ssh/transport/ossl/key-factory'
                  svc = KeyFactory.new( c.key_names )
                  svc.buffers = c.buffer_factory
                  svc.prompter = c.prompter if c.knows_key?( :prompter )
                  svc
                end

                # The factory for creating OpenSSL::BN (big number) instances.
                b.bn_factory { OpenSSL::BN }

                # The factory for converting digest names to digest implementations.
                b.digest_factory do |c,p|
                  require 'net/ssh/transport/ossl/digest-factory'
                  DigestFactory.new( c.digest_names )
                end

              end

              # Register each of the factories defined above in the corresponding
              # factory map, under the :ossl key.
              container.define do |b|
                b.cipher_factories[:ossl] = b.ossl.cipher_factory
                b.hmac_factories[:ossl]   = b.ossl.hmac_factory
                b.key_factories[:ossl]    = b.ossl.key_factory
                b.buffer_factories[:ossl] = b.ossl.buffer_factory
                b.bn_factories[:ossl]     = b.ossl.bn_factory
                b.digest_factories[:ossl] = b.ossl.digest_factory
              end
            end