Example #1
0
static bool _RSA_public_fields(
        const cjose_jwk_t *jwk, json_t *json, cjose_err *err)
{
    RSA *rsa = (RSA *)jwk->keydata;
    if (!_RSA_json_field(rsa->e, "e", json, err))
    {
        return false;
    }
    if (!_RSA_json_field(rsa->n, "n", json, err))
    {
        return false;
    }

    return true;
}
Example #2
0
File: jwk.c Project: tgorol/cjose
static bool _RSA_public_fields(
        const cjose_jwk_t *jwk, json_t *json, cjose_err *err)
{
    RSA *rsa = (RSA *)jwk->keydata;

    BIGNUM *rsa_n = NULL, *rsa_e = NULL, *rsa_d = NULL;
    _cjose_jwk_rsa_get(rsa, &rsa_n, &rsa_e, &rsa_d);

    if (!_RSA_json_field(rsa_e, "e", json, err))
    {
        return false;
    }
    if (!_RSA_json_field(rsa_n, "n", json, err))
    {
        return false;
    }

    return true;
}
Example #3
0
static bool _RSA_private_fields(
        const cjose_jwk_t *jwk, json_t *json, cjose_err *err)
{
    RSA *rsa = (RSA *)jwk->keydata;
    if (!_RSA_json_field(rsa->d, "d", json, err))
    {
        return false;
    }
    if (!_RSA_json_field(rsa->p, "p", json, err))
    {
        return false;
    }
    if (!_RSA_json_field(rsa->q, "q", json, err))
    {
        return false;
    }
    if (!_RSA_json_field(rsa->dmp1, "dp", json, err))
    {
        return false;
    }
    if (!_RSA_json_field(rsa->dmq1, "dq", json, err))
    {
        return false;
    }
    if (!_RSA_json_field(rsa->iqmp, "qi", json, err))
    {
        return false;
    }

    return true;
}
Example #4
0
File: jwk.c Project: tgorol/cjose
static bool _RSA_private_fields(
        const cjose_jwk_t *jwk, json_t *json, cjose_err *err)
{
    RSA *rsa = (RSA *)jwk->keydata;

    BIGNUM *rsa_n = NULL, *rsa_e = NULL, *rsa_d = NULL;
    _cjose_jwk_rsa_get(rsa, &rsa_n, &rsa_e, &rsa_d);

    BIGNUM *rsa_p = NULL, *rsa_q;
    _cjose_jwk_rsa_get_factors(rsa, &rsa_p, &rsa_q);

    BIGNUM *rsa_dmp1 = NULL, *rsa_dmq1 = NULL, *rsa_iqmp = NULL;
    _cjose_jwk_rsa_get_crt(rsa, &rsa_dmp1, &rsa_dmq1, &rsa_iqmp);

    if (!_RSA_json_field(rsa_d, "d", json, err))
    {
        return false;
    }
    if (!_RSA_json_field(rsa_p, "p", json, err))
    {
        return false;
    }
    if (!_RSA_json_field(rsa_q, "q", json, err))
    {
        return false;
    }
    if (!_RSA_json_field(rsa_dmp1, "dp", json, err))
    {
        return false;
    }
    if (!_RSA_json_field(rsa_dmq1, "dq", json, err))
    {
        return false;
    }
    if (!_RSA_json_field(rsa_iqmp, "qi", json, err))
    {
        return false;
    }

    return true;
}