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
[])
70 CORBA::ORB_init( argc
, argv
);
72 if (parse_args (argc
, argv
) != 0)
75 CORBA::Object_var obj
=
76 orb
->string_to_object( ior
);
78 Messenger_var messenger
=
79 Messenger::_narrow( obj
.in() );
81 CORBA::String_var message
=
82 CORBA::string_dup( "Terminating messenger service!" );
84 messenger
->send_message( "Chief of Security",
88 messenger
->shutdown("Chief of Security");
91 Security::SecQOPIntegrityAndConfidentiality
;
93 CORBA::Any want_protection
;
94 want_protection
<<= qop
;
96 CORBA::Policy_var policy
=
97 orb
->create_policy (Security::SecQOPPolicy
,
100 Security::EstablishTrust establish_trust
;
101 establish_trust
.trust_in_client
= 0;
102 establish_trust
.trust_in_target
= 1;
104 CORBA::Any want_trust
;
105 want_trust
<<= establish_trust
;
107 CORBA::Policy_var policy2
=
108 orb
->create_policy (Security::SecEstablishTrustPolicy
,
112 CORBA::PolicyList
policy_list (2);
113 policy_list
.length (1);
115 CORBA::Policy::_duplicate (policy
.in ());
116 policy_list
.length (2);
118 CORBA::Policy::_duplicate (policy2
.in ());
121 CORBA::Object_var object
=
122 obj
->_set_policy_overrides (policy_list
,
123 CORBA::SET_OVERRIDE
);
125 Messenger_var messenger2
=
126 Messenger::_narrow( object
.in() );
129 CORBA::string_dup( "Terminating messenger service!" );
131 messenger2
->send_message( "Chief of Security",
135 messenger2
->shutdown("Chief of Security");
139 catch(const CORBA::Exception
& ex
)
141 ex
._tao_print_exception("Client: main block");