Module: Rex::Proto::Sasl
- Included in:
- Net::LDAP::Connection::SocketSaslIO
- Defined in:
- lib/rex/proto/sasl.rb
Instance Method Summary collapse
-
#unwrap_sasl(data) ⇒ Object
Unwraps the data from a SASL structure, per RFC 4422.
-
#wrap_sasl(data) ⇒ Object
Wrap the data in a SASL structure, per RFC 4422 (basically just prepends a big-endian encoded 32-bit integer representing the length).
Instance Method Details
#unwrap_sasl(data) ⇒ Object
Unwraps the data from a SASL structure, per RFC 4422
10 11 12 13 14 15 16 17 |
# File 'lib/rex/proto/sasl.rb', line 10 def unwrap_sasl(data) length = data[0,4].unpack('N')[0] if length != data.length + 4 raise ArgumentError.new('Invalid SASL structure') end data[4,length] end |
#wrap_sasl(data) ⇒ Object
Wrap the data in a SASL structure, per RFC 4422 (basically just prepends a big-endian encoded 32-bit integer representing the length)
3 4 5 6 7 |
# File 'lib/rex/proto/sasl.rb', line 3 def wrap_sasl(data) length = [data.length].pack('N') length + data end |