lib/gssapi/simple.rb
# Wrap a message using gss_wrap. It can either encrypt the message (confidentiality) or simply sign it (integrity).
# @param [String] msg The message to wrap
# @param [Boolean] encrypt Whether or not to encrypt the message or just sign it.  The default is to encrypt.
# @return [String] The wrapped message. It will raise an exception on error
Wrap a message using gss_wrap. It can either encrypt the message (confidentiality) or simply sign it (integrity).
Wrap a message using gss_wrap . It can either encrypt the message ( confidentiality ) or simply sign it ( integrity ) .
def wrap_message(msg, encrypt = true)
      min_stat = FFI::MemoryPointer.new :OM_uint32
      conf_req = (encrypt ? 1 : 0)
      qop_req = GSSAPI::LibGSSAPI::GSS_C_QOP_DEFAULT
      in_buff = GSSAPI::LibGSSAPI::UnManagedGssBufferDesc.new
      in_buff.value = msg
      conf_state = FFI::MemoryPointer.new :OM_uint32
      out_buff = GSSAPI::LibGSSAPI::ManagedGssBufferDesc.new
      maj_stat = GSSAPI::LibGSSAPI.gss_wrap(min_stat, @context, conf_req, qop_req, in_buff.pointer, conf_state, out_buff.pointer)
      raise GssApiError.new(maj_stat, min_stat), "Failed to gss_wrap message" if maj_stat != 0
      out_buff.value
    end
def wrap_message ( msg , encrypt = true ) min_stat = FFI :: MemoryPointer . new :OM_uint32 conf_req = ( encrypt ? 1 : 0 ) qop_req = GSSAPI :: LibGSSAPI :: GSS_C_QOP_DEFAULT in_buff = GSSAPI :: LibGSSAPI :: UnManagedGssBufferDesc . new in_buff . value = msg conf_state = FFI :: MemoryPointer . new :OM_uint32 out_buff = GSSAPI :: LibGSSAPI :: ManagedGssBufferDesc . new maj_stat = GSSAPI :: LibGSSAPI . gss_wrap ( min_stat , @context , conf_req , qop_req , in_buff . pointer , conf_state , out_buff . pointer ) raise GssApiError . new ( maj_stat , min_stat ) , "Failed to gss_wrap message" if maj_stat != 0 out_buff . value end
Wrap a message using gss_wrap.
Wrap a message using gss_wrap .
The wrapped message. It will raise an exception on error
The wrapped message . It will raise an exception on error
String
msg
encrypt
encrypt Whether or not to encrypt the message or just sign it. The default is to encrypt.
encrypt Whether or not to encrypt the message or just sign it . The default is to encrypt .