#include "pkix_interface.h"
#include "hw_emul/hw_interface.h"
#include "oxmverifycommon.h"
+#include "casecurityinterface.h"
#define TAG "SAMPLE_MANUFACTURER_CERT"
}
}
-OCStackResult confirmCB(void * ctx)
+OCStackResult confirmCB_thread()
{
- OC_UNUSED(ctx);
for (;;)
{
int userConfirm;
}
if (1 == userConfirm)
{
+ SendUserConfirm(true);
break;
}
else if (0 == userConfirm)
{
- return OC_STACK_USER_DENIED_REQ;
+ SendUserConfirm(false);
+ break;
}
printf(" Entered Wrong Number. Please Enter Again\n");
}
return OC_STACK_OK;
}
+OCStackResult confirmCB(void * ctx)
+{
+ OC_UNUSED(ctx);
+ pthread_t threadId;
+ pthread_create (&threadId, NULL, &confirmCB_thread, NULL);
+ return OC_STACK_OK;
+}
+
+void confirmNoCertCB(CACertificateVerificationStatus_t status)
+{
+ if (CA_CERTIFICATE_VERIFY_SUCCESS_MUTUAL == status)
+ {
+ printf(" > Peer certificate verification successful");
+ }
+ else if (CA_CERTIFICATE_VERIFY_NO_CERT == status)
+ {
+ printf(" > Peer has not provided certificate\n");
+ }
+ else if (CA_CERTIFICATE_VERIFY_FAILED == status)
+ {
+ printf(" > Peer certificate verification failed\n");
+ }
+ return;
+}
+
+void informOxmSelCB(OicSecOxm_t oxmSel)\r
+{\r
+ printf(" > OXM selected: 0x%x\n", oxmSel);\r
+}\r
+\r
FILE* server_fopen(const char *path, const char *mode)
{
(void)path;
// Initialize Persistent Storage for SVR database
OCPersistentStorage ps = {server_fopen, fread, fwrite, fclose, unlink, NULL, NULL};
- SetUserConfirmCB(NULL, confirmCB);
+ SetAsyncUserConfirmCB(NULL, confirmCB);
+ SetInformOxmSelCB(informOxmSelCB);
+ CAsetCertificateVerificationCallback(confirmNoCertCB);
OCRegisterPersistentStorageHandler(&ps);