|
reSIProcate/repro
9694
|
00001 #include "resip/stack/Pkcs8Contents.hxx" 00002 #include "resip/stack/ssl/Security.hxx" 00003 #include "resip/dum/ServerSubscription.hxx" 00004 #include "resip/dum/ServerPublication.hxx" 00005 #include "repro/stateAgents/PrivateKeySubscriptionHandler.hxx" 00006 00007 using namespace repro; 00008 using namespace resip; 00009 00010 PrivateKeySubscriptionHandler::PrivateKeySubscriptionHandler(resip::Security& security) : mSecurity(security) 00011 { 00012 } 00013 00014 void 00015 PrivateKeySubscriptionHandler::onNewSubscription(ServerSubscriptionHandle h, const SipMessage& sub) 00016 { 00017 if (h->getDocumentKey() != h->getSubscriber()) 00018 { 00019 h->send(h->accept(403)); // !jf! is this the correct code? 00020 } 00021 else if (mSecurity.hasUserCert(h->getDocumentKey())) 00022 { 00023 Pkcs8Contents pkcs(mSecurity.getUserPrivateKeyDER(h->getDocumentKey())); 00024 h->send(h->update(&pkcs)); 00025 } 00026 else 00027 { 00028 h->reject(404); 00029 } 00030 } 00031 00032 void 00033 PrivateKeySubscriptionHandler::onPublished(ServerSubscriptionHandle associated, 00034 ServerPublicationHandle publication, 00035 const Contents* contents, 00036 const SecurityAttributes* attrs) 00037 { 00038 associated->send(associated->update(contents)); 00039 } 00040 00041 void 00042 PrivateKeySubscriptionHandler::onTerminated(ServerSubscriptionHandle) 00043 { 00044 } 00045 00046 void 00047 PrivateKeySubscriptionHandler::onError(ServerSubscriptionHandle, const SipMessage& msg) 00048 { 00049 }
1.7.5.1