3 #include "orbsvcs/SecurityC.h"
4 #include "MessengerC.h"
5 #include "ace/Get_Opt.h"
8 The servers service configuration file
10 ---------------------------------------
12 dynamic SSLIOP_Factory Service_Object
*
13 TAO_SSLIOP
:_make_TAO_SSLIOP_Protocol_Factory()
15 -SSLAuthenticate SERVER_AND_CLIENT \
16 -SSLPrivateKey PEM:server_key.pem \
17 -SSLCertificate PEM:server_cert.pem"
19 static Resource_Factory
"-ORBProtocolFactory SSLIOP_Factory"
20 ---------------------------------------
22 The clients service configuration file
24 ---------------------------------------
26 dynamic SSLIOP_Factory Service_Object
*
27 TAO_SSLIOP
:_make_TAO_SSLIOP_Protocol_Factory()
29 -SSLAuthenticate SERVER \
30 -SSLPrivateKey PEM:client_key.pem \
31 -SSLCertificate PEM:client_cert.pem"
33 static Resource_Factory
"-ORBProtocolFactory SSLIOP_Factory"
34 ---------------------------------------
37 const ACE_TCHAR
*ior
= ACE_TEXT ("file://Messenger.ior");
40 parse_args (int argc
, ACE_TCHAR
*argv
[])
42 ACE_Get_Opt
get_opts (argc
, argv
, ACE_TEXT("k:"));
45 while ((c
= get_opts ()) != -1)
49 ior
= get_opts
.opt_arg ();
54 ACE_ERROR_RETURN ((LM_ERROR
,
61 // Indicates successful parsing of the command line
66 ACE_TMAIN (int argc
, ACE_TCHAR
*argv
[])
71 CORBA::ORB_init( argc
, argv
);
73 if (parse_args (argc
, argv
) != 0)
76 CORBA::Object_var obj
=
77 orb
->string_to_object( ior
);
79 Messenger_var messenger
=
80 Messenger::_narrow( obj
.in() );
82 CORBA::String_var message
=
83 CORBA::string_dup( "Terminating messenger service!" );
85 messenger
->send_message( "Chief of Security",
89 messenger
->shutdown("Chief of Security");
92 Security::SecQOPIntegrityAndConfidentiality
;
94 CORBA::Any want_protection
;
95 want_protection
<<= qop
;
97 CORBA::Policy_var policy
=
98 orb
->create_policy (Security::SecQOPPolicy
,
101 Security::EstablishTrust establish_trust
;
102 establish_trust
.trust_in_client
= 0;
103 establish_trust
.trust_in_target
= 1;
105 CORBA::Any want_trust
;
106 want_trust
<<= establish_trust
;
108 CORBA::Policy_var policy2
=
109 orb
->create_policy (Security::SecEstablishTrustPolicy
,
113 CORBA::PolicyList
policy_list (2);
114 policy_list
.length (1);
116 CORBA::Policy::_duplicate (policy
.in ());
117 policy_list
.length (2);
119 CORBA::Policy::_duplicate (policy2
.in ());
122 CORBA::Object_var object
=
123 obj
->_set_policy_overrides (policy_list
,
124 CORBA::SET_OVERRIDE
);
126 Messenger_var messenger2
=
127 Messenger::_narrow( object
.in() );
130 CORBA::string_dup( "Terminating messenger service!" );
132 messenger2
->send_message( "Chief of Security",
136 messenger2
->shutdown("Chief of Security");
140 catch(const CORBA::Exception
& ex
)
142 ex
._tao_print_exception("Client: main block");