This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CCS/CC3220SF-LAUNCHXL: CRYPTO Sample

Part Number: CC3220SF-LAUNCHXL

Tool/software: Code Composer Studio

Dear  Sir,

i have to decry-pt cloud data which encrypted using our public key .well i'm getting data from the cloud server that data i have to decry-pt by using our private key.

so can i used cc3220 crypto library for this description ? is yes could you share me some example for the encryption and description method

Note:- key pair value which are generated by the OpenSSL tool. this key value pair are private_key.pem and public_key.pem which are written in the CC3220 file system by the uni flash 

  • The device includes AES and DES/3DES crypto accelerators.

    You can use them through the CryptoCC32XX_decrypt() API.

    There is no example currently.

    Br,

    Kobi

  • Dear Kobi,

    i already tried with CryptoCC32XX_decrypt API but seems like i'm missing something.

    here my sample code for the decry-pt the data.here i'm not getting any error for the decry-pt but length of the the output data is zero (outputDataLen)

    CryptoCC32XX_init();

    crypto_handle = CryptoCC32XX_open(BOARD_CRYPTO0,
    CryptoCC32XX_AES | CryptoCC32XX_DES | CryptoCC32XX_HMAC);

    if (crypto_handle <= NULL)
    {
    SHOW_ERROR(rc, "CryptoCC32XX_open() failed");
    CryptoCC32XX_close(crypto_handle);
    return HTTPS_CLOUD_SERVICES_TOKEN_PARSER_FAILED;
    }

    CryptoCC32XX_EncryptMethod method = CryptoCC32XX_AES_ECB;

    CryptoCC32XX_EncryptParams params;

    params.aes.keySize = CryptoCC32XX_AES_KEY_SIZE_256BIT;

    params.aes.pKey = (const uint8_t*) private_key1;

    cipherDataLen = strlen(WM_HttpsCloud->httpsBodyAndResponse);

    rc = CryptoCC32XX_decrypt(crypto_handle, method, WM_HttpsCloud->httpsBodyAndResponse, cipherDataLen, outputData,
    &outputDataLen, &params);

    if (rc < 0)
    {
    SHOW_ERROR(rc, "CryptoCC32XX_open() failed");
    CryptoCC32XX_close(crypto_handle);
    return HTTPS_CLOUD_SERVICES_TOKEN_PARSER_FAILED;
    }
    else
    {
    int i = 0;

    WMLogInfo(DEBUG_LOG, "decrypted output legnth %ld", outputDataLen);

    if ((outputDataLen <= 0) || (outputDataLen >= cipherDataLen))
    {
    outputDataLen = 0;
    }
    for (i = 0; i < outputDataLen; i++)
    {
    WMLogInfo(DEBUG_LOG, "decrypted data [%c] = [%02x]", outputData[i], outputData[i]);
    }
    }

    CryptoCC32XX_close(crypto_handle);

  • Part Number: CC3220SF-LAUNCHXL

    Tool/software: Code Composer Studio

    Dear Sir,

    i have to achieves some cloud connection and data encryption and decryption stuff using private key and public key. here i'm using CC3220 device with simplelink_cc32xx_sdk_4_20_00_07 for the our customize board application.

    i was reading about the Secured Content Delivery in user guidelines but could able to get more details about how to implement in software.

    process of the my flow which i have been looking for.

    step 1:- get access token from the https server (reply would be the json format with  normal string)

    step 2: use step 1 token for the get the gateway_id (reply would be the json format with gateway_id) 

    step 3: use step 2 gateway_id for the get the new access token (reply would be the encrypted data which is encrypted by the public key and this public key i will sent while step 2)

    step 4: decry-pt the reply of the step 3 using private key (here i will get the final access token for my other step)

    This the step which i have to follow to get the access token from the cloud.here i archived step 1 and step 2 but while in step 3 i have an encrypted data which i have decry-pt for the step 4.

    Well for me it's going to be one of the fun thing.

    Here i was trying to decry-pt the data using simplelink_cc32xx_sdk_4_20_00_07  crypto library but it seems i'm not able to get something  by using CryptoCC32XX_decrypt.

    Can i used CryptoCC32XX_decrypt API for the decry-pt the data using by the private key ? if yes cloud please share some information about it.

    i notice while using CryptoCC32XX_decrypt API that was this API ( CryptoCC32XX_decrypt)  does not fill the decry-pt data length after the decry-pt something. 

    Well in Secured Content Delivery NWP internal decry-pt the received data ? 

    Note : - i share my public key to sever while sending a body in step 2. here the key is .PEM format with base64 string. while seeing the key install process in Secured Content Delivery i notice that key should be in .DER foramt . how could i do this stuff for the use of the Secured Content Delivery

     

    Please share me ASAP. it been critical now.

    Thanks 

    Ketan.

  • The output data length is the same as the input length and it is not being updated.

  • you should use openssl (or other tls/ssl tool or web-site) to covert from PEM to DER. It is easy to find the instructions.

    If you need the conversion in run-time, you can look for a code for the conversion. Check for example the B64_Decode() in the SDK's ota library (in OtaJson.c).

    Br,

    Kobi

  • Dear Kobi,

    I am not worry about the other thing here i am worry about the Secured Content Delivery and decryption and encryption.

    So tell me the how do i do the Secured Content Delivery and encryption and decryption using public key and private key

  • Ok, so for the secure content delivery, you can refer to te following example:

    /cfs-file/__key/communityserver-discussions-components-files/968/SecureDeliveryTester.zip 

    This project simulates the secure content delivery but passes the information over terminal uart rather than a real connection. It is manual and focuses on the sequence for creating the secure content.

    This zip file include a CCS project. If you run it, it will retrieve the public key of the device and print it through the terminal.

    You should copy the public key and use it as an input for the bash script.

    The bash script will also get the plain message as an input and generate the binary encrypted message.

    The last thing is to inject the message back to the application (using the terminal) which will extract the content in the file system (as a secure/private file).

    Check the README for more details.

    Br,

    Kobi

  • Hi Kobi,

    Thank you for reply.

    I want to encrypt some message using private key, And sometime i want decrypt received data using our private key.

    could you please suggest me how to encrypt and decrypt message with private key using TI Crypto system or suggest us any third party Crypto lib?

    --

    with regards,

    Ketan

      

  • You are already familiar with our crypto driver (AES/DES/3DES).

    You can also use external software for that.

    Br,

    Kobi

  • Dear Kobi,

    we can you asymmetric method for AES by using crypto  driver.

    i would like to have a email conversion with you..

    Here is my Email : ketan@wimerasys.com

  • Hi Ketan,

     

    The encryption/decryption are typically based on a symmetric key.

    The a-symmetric keys are used for authentication and symmetric (session) key distribution.

    This is typically done within a TLS/SSL network stack.

    We have internal one within the NWP for the secure sockets use-cases.

    If you need an external one you can find couple of options for an embedded system, e.g. wolfssl, embedtls

    The secure content delivery is the only method we support for decryption of messages. It is based on the unique device key pair, which is served (with the remote key pair) in the generation of the symmetric key used (internally by the network processor) to trigger the AES engine.

     

    Br,

    Kobi