2 * Copyright (c) 2014 <copyright holder> <email>
4 * For license details, see the LICENSE file in the root of this project.
9 #include <cache/GSSContextCache.h>
11 GSSUnwrap::GSSUnwrap ( JSONObject* params, gss_unwrap_type fn )
14 loadParameters(params);
17 bool GSSUnwrap::loadParameters(JSONObject *params)
20 std::string sInputMessage;
31 if ( ! params->get("input_message").isNull() )
33 sInputMessage = params->get("input_message").string();
34 this->inputMessage.setValue(sInputMessage);
40 if ( ! params->get("context_handle").isNull() )
42 sInputMessage = params->get("context_handle").string();
43 GSSContext ctx = GSSContextCache::instance()->retrieve(sInputMessage);
44 this->context = ctx.getContext();
53 void GSSUnwrap::execute()
56 gss_buffer_desc output_buf;
59 &(this->minor_status),
61 this->inputMessage.toGss(),
67 this->outputMessage.setValue( (char *)output_buf.value, output_buf.length );
70 JSONObject* GSSUnwrap::toJSON()
73 const char *conf_state;
74 JSONObject *values = new JSONObject();
83 values->set("major_status", this->retVal);
84 values->set("minor_status", this->minor_status);
86 values->set("qop_state", this->qop_state);
88 conf_state = (this->conf_state) ? "TRUE" : "FALSE";
89 values->set("conf_state", conf_state);
93 this->outputMessage.toString().c_str()