Class: Net::NTLM::ChannelBinding
- Inherits:
-
Object
- Object
- Net::NTLM::ChannelBinding
- Defined in:
- lib/net/ntlm/channel_binding.rb
Instance Attribute Summary collapse
-
#acceptor_address_length ⇒ Object
readonly
Returns the value of attribute acceptor_address_length.
-
#acceptor_addrtype ⇒ Object
readonly
Returns the value of attribute acceptor_addrtype.
-
#channel ⇒ Object
readonly
Returns the value of attribute channel.
-
#initiator_address_length ⇒ Object
readonly
Returns the value of attribute initiator_address_length.
-
#initiator_addtype ⇒ Object
readonly
Returns the value of attribute initiator_addtype.
-
#unique_prefix ⇒ Object
readonly
Returns the value of attribute unique_prefix.
Class Method Summary collapse
-
.create(outer_channel) ⇒ NTLM::ChannelBinding
Creates a ChannelBinding used for Extended Protection Authentication.
Instance Method Summary collapse
- #application_data ⇒ Object
-
#channel_binding_token ⇒ String
Returns a channel binding hash acceptable for use as a AV_PAIR MsvAvChannelBindings field value as specified in the NTLM protocol.
- #channel_hash ⇒ Object
- #gss_channel_bindings_struct ⇒ Object
-
#initialize(outer_channel) ⇒ ChannelBinding
constructor
A new instance of ChannelBinding.
Constructor Details
#initialize(outer_channel) ⇒ ChannelBinding
Returns a new instance of ChannelBinding.
18 19 20 21 22 23 24 25 |
# File 'lib/net/ntlm/channel_binding.rb', line 18 def initialize(outer_channel) @channel = outer_channel @unique_prefix = 'tls-server-end-point' @initiator_addtype = 0 @initiator_address_length = 0 @acceptor_addrtype = 0 @acceptor_address_length = 0 end |
Instance Attribute Details
#acceptor_address_length ⇒ Object (readonly)
Returns the value of attribute acceptor_address_length.
29 30 31 |
# File 'lib/net/ntlm/channel_binding.rb', line 29 def acceptor_address_length @acceptor_address_length end |
#acceptor_addrtype ⇒ Object (readonly)
Returns the value of attribute acceptor_addrtype.
28 29 30 |
# File 'lib/net/ntlm/channel_binding.rb', line 28 def acceptor_addrtype @acceptor_addrtype end |
#channel ⇒ Object (readonly)
Returns the value of attribute channel.
27 28 29 |
# File 'lib/net/ntlm/channel_binding.rb', line 27 def channel @channel end |
#initiator_address_length ⇒ Object (readonly)
Returns the value of attribute initiator_address_length.
28 29 30 |
# File 'lib/net/ntlm/channel_binding.rb', line 28 def initiator_address_length @initiator_address_length end |
#initiator_addtype ⇒ Object (readonly)
Returns the value of attribute initiator_addtype.
27 28 29 |
# File 'lib/net/ntlm/channel_binding.rb', line 27 def initiator_addtype @initiator_addtype end |
#unique_prefix ⇒ Object (readonly)
Returns the value of attribute unique_prefix.
27 28 29 |
# File 'lib/net/ntlm/channel_binding.rb', line 27 def unique_prefix @unique_prefix end |
Class Method Details
.create(outer_channel) ⇒ NTLM::ChannelBinding
Creates a ChannelBinding used for Extended Protection Authentication
12 13 14 |
# File 'lib/net/ntlm/channel_binding.rb', line 12 def self.create(outer_channel) new(outer_channel) end |
Instance Method Details
#application_data ⇒ Object
55 56 57 58 59 60 61 62 |
# File 'lib/net/ntlm/channel_binding.rb', line 55 def application_data @application_data ||= begin data = unique_prefix data << ':' data << channel_hash.digest data end end |
#channel_binding_token ⇒ String
Returns a channel binding hash acceptable for use as a AV_PAIR MsvAvChannelBindings
field value as specified in the NTLM protocol
35 36 37 |
# File 'lib/net/ntlm/channel_binding.rb', line 35 def channel_binding_token @channel_binding_token ||= OpenSSL::Digest::MD5.new(gss_channel_bindings_struct).digest end |
#channel_hash ⇒ Object
51 52 53 |
# File 'lib/net/ntlm/channel_binding.rb', line 51 def channel_hash @channel_hash ||= OpenSSL::Digest::SHA256.new(channel.to_der) end |
#gss_channel_bindings_struct ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/net/ntlm/channel_binding.rb', line 39 def gss_channel_bindings_struct @gss_channel_bindings_struct ||= begin token = [initiator_addtype].pack('I') token << [initiator_address_length].pack('I') token << [acceptor_addrtype].pack('I') token << [acceptor_address_length].pack('I') token << [application_data.length].pack('I') token << application_data token end end |