2 * Copyright (c) 2014 <copyright holder> <email>
4 * For license details, see the LICENSE file in the root of this project.
8 #ifndef GSSPSEUDORANDOMCOMMAND_H
9 #define GSSPSEUDORANDOMCOMMAND_H
11 #include <openssl/rand.h>
12 #include <gssapi/gssapi.h>
14 #include "datamodel/GSSBuffer.h"
15 #include "GSSCommand.h"
17 typedef OM_uint32 (*gss_pseudo_random_type) (
18 OM_uint32 *, /* minor_status */
19 gss_ctx_id_t, /* context */
21 const gss_buffer_t, /* prf_in */
22 ssize_t, /* desired_output_len */
23 gss_buffer_t); /* prf_out */
25 class GSSPseudoRandom : public GSSCommand
28 GSSPseudoRandom(gss_pseudo_random_type fn = &gss_pseudo_random) : function(fn) {};
29 GSSPseudoRandom(JSONObject *params,
30 gss_pseudo_random_type fn = &gss_pseudo_random);
33 bool loadParameters(JSONObject *params);
36 void setContextHandle ( gss_ctx_id_t desiredContext ) { context = (desiredContext); };
37 void setKey ( int prf_in ) { key = (prf_in); };
38 void setInputMessage ( const GSSBuffer prf_in ) { inputMessage.setValue(prf_in.toString()); };
39 void setDesiredOutputLength ( int desired_output_len ) { desiredOutputLength =desired_output_len; };
42 GSSBuffer getInputMessage() { return inputMessage; }
43 GSSBuffer getOutputMessage() { return outputMessage; }
44 OM_uint32 getRetVal() { return(retVal); }
45 OM_uint32 getMinorStatus() { return(minor_status); }
46 int getKey() { return(key); }
47 int getDesiredOutputLength() { return(desiredOutputLength); }
48 gss_pseudo_random_type getGSSFunction() { return function; };
51 OM_uint32 retVal, minor_status;
52 gss_pseudo_random_type function;
54 int key, desiredOutputLength;
55 GSSBuffer inputMessage;
56 GSSBuffer outputMessage;
59 #endif // GSSPSEUDORANDOMCOMMAND_H