Search code examples
cencryptionjwe

JSON web encryption using cjsoe


Any help please on how to use the cjose library with a simple JSON. JSON example from the ietf-jose

Can someone give me some indications? thanks


Solution

  • There is no one to one correspondence between given Json example and Json examples from cjose. But you may want to understanding how algorithms are applied studying functions from test, especially

    static void _self_encrypt_self_decrypt(const char *plain1)

    static void _self_encrypt_self_decrypt_with_key(const char *alg, const char *enc, const char *key, const char *plain1)
    

    with

     _self_encrypt_self_decrypt_with_key(CJOSE_HDR_ALG_A128KW, CJOSE_HDR_ENC_A128CBC_HS256, JWK_OCT_16, plain1);
    

    and main test functions

    START_TEST(test_cjose_jwe_node_jose_encrypt_self_decrypt)
    START_TEST(test_cjose_jwe_multiple_recipients)