mirror of
https://github.com/PurpleI2P/i2pd
synced 2024-11-10 08:00:38 +03:00
fix #622. extract correct CN
This commit is contained in:
parent
32669cb07f
commit
c4171a01bd
12
Reseed.cpp
12
Reseed.cpp
@ -345,11 +345,21 @@ namespace data
|
|||||||
// extract issuer name
|
// extract issuer name
|
||||||
char name[100];
|
char name[100];
|
||||||
X509_NAME_oneline (X509_get_issuer_name(cert), name, 100);
|
X509_NAME_oneline (X509_get_issuer_name(cert), name, 100);
|
||||||
|
char * cn = strstr (name, "CN=");
|
||||||
|
if (cn)
|
||||||
|
{
|
||||||
|
cn += 3;
|
||||||
|
char * terminator = strchr (cn, '/');
|
||||||
|
if (terminator) terminator[0] = 0;
|
||||||
|
}
|
||||||
// extract RSA key (we need n only, e = 65537)
|
// extract RSA key (we need n only, e = 65537)
|
||||||
RSA * key = X509_get_pubkey (cert)->pkey.rsa;
|
RSA * key = X509_get_pubkey (cert)->pkey.rsa;
|
||||||
PublicKey value;
|
PublicKey value;
|
||||||
i2p::crypto::bn2buf (key->n, value, 512);
|
i2p::crypto::bn2buf (key->n, value, 512);
|
||||||
m_SigningKeys[name] = value;
|
if (cn)
|
||||||
|
m_SigningKeys[cn] = value;
|
||||||
|
else
|
||||||
|
LogPrint (eLogError, "Reseed: Can't find CN field in ", filename);
|
||||||
}
|
}
|
||||||
SSL_free (ssl);
|
SSL_free (ssl);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user