mirror of
https://github.com/curl/curl.git
synced 2024-12-15 06:40:09 +08:00
parent
d7fb9ab7ce
commit
137a668e8c
@ -945,6 +945,24 @@ static int do_pubkey(struct Curl_easy *data, int certnum,
|
||||
|
||||
/* Generate all information records for the public key. */
|
||||
|
||||
if(strcasecompare(algo, "ecPublicKey")) {
|
||||
/*
|
||||
* ECC public key is all the data, a value of type BIT STRING mapped to
|
||||
* OCTET STRING and should not be parsed as an ASN.1 value.
|
||||
*/
|
||||
const unsigned long len =
|
||||
(unsigned long)((pubkey->end - pubkey->beg - 2) * 4);
|
||||
if(!certnum)
|
||||
infof(data, " ECC Public Key (%lu bits)", len);
|
||||
if(data->set.ssl.certinfo) {
|
||||
char q[sizeof(len) * 8 / 3 + 1];
|
||||
msnprintf(q, sizeof(q), "%lu", len);
|
||||
if(Curl_ssl_push_certinfo(data, certnum, "ECC Public Key", q))
|
||||
return 1;
|
||||
}
|
||||
return do_pubkey_field(data, certnum, "ecPublicKey", pubkey);
|
||||
}
|
||||
|
||||
/* Get the public key (single element). */
|
||||
if(!getASN1Element(&pk, pubkey->beg + 1, pubkey->end))
|
||||
return 1;
|
||||
@ -971,14 +989,10 @@ static int do_pubkey(struct Curl_easy *data, int certnum,
|
||||
if(!certnum)
|
||||
infof(data, " RSA Public Key (%lu bits)", len);
|
||||
if(data->set.ssl.certinfo) {
|
||||
q = curl_maprintf("%lu", len);
|
||||
if(q) {
|
||||
CURLcode result =
|
||||
Curl_ssl_push_certinfo(data, certnum, "RSA Public Key", q);
|
||||
free((char *) q);
|
||||
if(result)
|
||||
return 1;
|
||||
}
|
||||
char r[sizeof(len) * 8 / 3 + 1];
|
||||
msnprintf(r, sizeof(r), "%lu", len);
|
||||
if(Curl_ssl_push_certinfo(data, certnum, "RSA Public Key", r))
|
||||
return 1;
|
||||
}
|
||||
/* Generate coefficients. */
|
||||
if(do_pubkey_field(data, certnum, "rsa(n)", &elem))
|
||||
|
Loading…
Reference in New Issue
Block a user