"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/md_jws.c" between
mod_md-2.4.2.tar.gz and mod_md-2.4.4.tar.gz

About: mod_md is an Apache module that adds Let's Encrypt (ACME) support.

md_jws.c  (mod_md-2.4.2):md_jws.c  (mod_md-2.4.4)
skipping to change at line 41 skipping to change at line 41
return 1; return 1;
} }
apr_status_t md_jws_sign(md_json_t **pmsg, apr_pool_t *p, apr_status_t md_jws_sign(md_json_t **pmsg, apr_pool_t *p,
md_data_t *payload, struct apr_table_t *protected, md_data_t *payload, struct apr_table_t *protected,
struct md_pkey_t *pkey, const char *key_id) struct md_pkey_t *pkey, const char *key_id)
{ {
md_json_t *msg, *jprotected; md_json_t *msg, *jprotected;
const char *prot64, *pay64, *sign64, *sign, *prot; const char *prot64, *pay64, *sign64, *sign, *prot;
apr_status_t rv = APR_SUCCESS; apr_status_t rv = APR_SUCCESS;
md_data_t data;
*pmsg = NULL; *pmsg = NULL;
msg = md_json_create(p); msg = md_json_create(p);
jprotected = md_json_create(p); jprotected = md_json_create(p);
md_json_sets("RS256", jprotected, "alg", NULL); md_json_sets("RS256", jprotected, "alg", NULL);
if (key_id) { if (key_id) {
md_json_sets(key_id, jprotected, "kid", NULL); md_json_sets(key_id, jprotected, "kid", NULL);
} }
skipping to change at line 67 skipping to change at line 66
apr_table_do(header_set, jprotected, protected, NULL); apr_table_do(header_set, jprotected, protected, NULL);
prot = md_json_writep(jprotected, p, MD_JSON_FMT_COMPACT); prot = md_json_writep(jprotected, p, MD_JSON_FMT_COMPACT);
md_log_perror(MD_LOG_MARK, MD_LOG_TRACE4, 0, p, "protected: %s", md_log_perror(MD_LOG_MARK, MD_LOG_TRACE4, 0, p, "protected: %s",
prot ? prot : "<failed to serialize!>"); prot ? prot : "<failed to serialize!>");
if (!prot) { if (!prot) {
} }
if (rv == APR_SUCCESS) { if (rv == APR_SUCCESS) {
data.data = prot; md_data_t data;
data.len = strlen(prot);
md_data_init(&data, prot, strlen(prot));
prot64 = md_util_base64url_encode(&data, p); prot64 = md_util_base64url_encode(&data, p);
md_json_sets(prot64, msg, "protected", NULL); md_json_sets(prot64, msg, "protected", NULL);
pay64 = md_util_base64url_encode(payload, p); pay64 = md_util_base64url_encode(payload, p);
md_json_sets(pay64, msg, "payload", NULL); md_json_sets(pay64, msg, "payload", NULL);
sign = apr_psprintf(p, "%s.%s", prot64, pay64); sign = apr_psprintf(p, "%s.%s", prot64, pay64);
rv = md_crypt_sign64(&sign64, pkey, p, sign, strlen(sign)); rv = md_crypt_sign64(&sign64, pkey, p, sign, strlen(sign));
} }
skipping to change at line 107 skipping to change at line 107
apr_status_t rv; apr_status_t rv;
e64 = md_pkey_get_rsa_e64(pkey, p); e64 = md_pkey_get_rsa_e64(pkey, p);
n64 = md_pkey_get_rsa_n64(pkey, p); n64 = md_pkey_get_rsa_n64(pkey, p);
if (!e64 || !n64) { if (!e64 || !n64) {
return APR_EINVAL; return APR_EINVAL;
} }
/* whitespace and order is relevant, since we hand out a digest of this */ /* whitespace and order is relevant, since we hand out a digest of this */
s = apr_psprintf(p, "{\"e\":\"%s\",\"kty\":\"RSA\",\"n\":\"%s\"}", e64, n64) ; s = apr_psprintf(p, "{\"e\":\"%s\",\"kty\":\"RSA\",\"n\":\"%s\"}", e64, n64) ;
MD_DATA_SET_STR(&data, s); md_data_init_str(&data, s);
rv = md_crypt_sha256_digest64(pthumb, p, &data); rv = md_crypt_sha256_digest64(pthumb, p, &data);
return rv; return rv;
} }
 End of changes. 3 change blocks. 
4 lines changed or deleted 4 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)