Method: GSSAPI::Simple#wrap_message
- Defined in:
- lib/gssapi/simple.rb
#wrap_message(msg, encrypt = true) ⇒ String
Wrap a message using gss_wrap. It can either encrypt the message (confidentiality) or simply sign it (integrity).
167 168 169 170 171 172 173 174 175 176 177 178 |
# File 'lib/gssapi/simple.rb', line 167 def (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 |