#include "aclresource.h"
#include "crlresource.h"
#include "ocprovisioningmanager.h"
+#include "casecurityinterface.h"
+#include "mbedtls/ssl_ciphersuites.h"
#include "utils.h"
#include "cloudAuth.h"
printf("** %d - Change default port\n", PORT);
printf("** %d - Change default database filename\n", DB_FILE);
printf("** %d - Change default auth provider\n", AUTH_PROVIDER);
- printf("** %d - Change TLS cipher suite to RSA\n", USE_RSA);
+ printf("** %d - Change TLS cipher suite (ECDSA/RSA)\n", USE_RSA);
printf("** %d - Save Trust Cert. Chain into Cred of SVR\n", SAVE_TRUST_CERT);
printf("** %d - Change Protocol type (CoAP/CoAPs)\n", USE_SECURE_CONN);
printf("** %d - ACL Cancel invitation Request\n", ACL_GROUP_CANCEL_INVITE);
printf("** EXIT\n");
- printf("** %d - Exit cloud %s\n\n", EXIT, title);
+ printf("** %d - Exit cloud %s\n", EXIT, title);
printf("************************************************************\n");
-
- printf(">> Enter Menu number:\n");
}
void unlockMenu(void *data)
OCStackResult res = OC_STACK_ERROR;
OIC_LOG(INFO, TAG, "Save Trust Cert. Chain into Cred of SVR");
- ByteArray trustCertChainArray = {0, 0};
+ ByteArray_t trustCertChainArray = {0, 0};
const char *filename = "rootca.crt";
if (!readFile(filename, (OCByteString *)&trustCertChainArray))
res = OCSaveTrustCertChain(trustCertChainArray.data, trustCertChainArray.len, OIC_ENCODING_PEM,&g_credId);
- if(OC_STACK_OK != res)
+ if (OC_STACK_OK != res)
{
- OIC_LOG(ERROR, TAG, "OCSaveTrustCertChainBin API error");
- return res;
+ OIC_LOG(ERROR, TAG, "OCSaveTrustCertChain API error");
}
- OIC_LOG_V(INFO, TAG, "CredId of Saved Trust Cert. Chain into Cred of SVR : %d.\n", g_credId);
+ else
+ {
+ OIC_LOG_V(INFO, TAG, "CredId of Saved Trust Cert. Chain into Cred of SVR : %d.\n", g_credId);
+ }
+ OICFree(trustCertChainArray.data);
return res;
}
printMenu(mode);
int request = 0;
- scanf("%d", &request);
+ readInteger(&request, "Menu number", "see above");
switch (request)
{
res= InitRequest(OC_REST_POST);
break;
case USE_RSA:
- CASelectCipherSuite(0x35, CA_ADAPTER_TCP);
+ {
+ int tmp = 0;
+ readInteger(&tmp, "Select Cipher Suite", "0 - ECDSA, other - RSA");
+ uint16_t cipher = tmp? MBEDTLS_TLS_RSA_WITH_AES_256_CBC_SHA:
+ MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_CCM_8;
+ if (CA_STATUS_OK != CASelectCipherSuite(cipher, CA_ADAPTER_TCP))
+ {
+ OIC_LOG(ERROR, TAG, "CASelectCipherSuite returned an error");
+ }
sendDataToServer = false;
+ }
break;
case SAVE_TRUST_CERT:
saveTrustCert();