mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-25 22:45:05 +00:00
Fixed check_signature().
This commit is contained in:
parent
73a02fca6f
commit
2688230a19
1 changed files with 2 additions and 7 deletions
9
http.c
9
http.c
|
@ -108,8 +108,6 @@ int check_signature(snac *snac, char *req)
|
||||||
xs *keyId = NULL;
|
xs *keyId = NULL;
|
||||||
xs *headers = NULL;
|
xs *headers = NULL;
|
||||||
xs *signature = NULL;
|
xs *signature = NULL;
|
||||||
xs *sig_bin = NULL;
|
|
||||||
int s_size;
|
|
||||||
char *pubkey;
|
char *pubkey;
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
|
@ -127,7 +125,7 @@ int check_signature(snac *snac, char *req)
|
||||||
headers = xs_crop(xs_dup(v), 9, -1);
|
headers = xs_crop(xs_dup(v), 9, -1);
|
||||||
else
|
else
|
||||||
if (xs_startswith(v, "signature"))
|
if (xs_startswith(v, "signature"))
|
||||||
signature = xs_crop(xs_dup(v), 12, -1);
|
signature = xs_crop(xs_dup(v), 11, -1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -187,10 +185,7 @@ int check_signature(snac *snac, char *req)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* convert the signature to binary */
|
if (xs_evp_verify(pubkey, sig_str, strlen(sig_str), signature) != 1) {
|
||||||
sig_bin = xs_base64_dec(signature, &s_size);
|
|
||||||
|
|
||||||
if (xs_evp_verify(pubkey, sig_str, strlen(sig_str), sig_bin) != 1) {
|
|
||||||
snac_debug(snac, 1, xs_fmt("rsa verify error %s", keyId));
|
snac_debug(snac, 1, xs_fmt("rsa verify error %s", keyId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue