Browse Source

extract CN

pull/387/head
orignal 9 years ago
parent
commit
008583396d
  1. 13
      Family.cpp

13
Family.cpp

@ -32,8 +32,13 @@ 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 * family = strstr (name, ".family"); char * cn = strstr (name, "CN=");
if (family) family[0] = 0; if (cn)
{
cn += 3;
char * family = strstr (cn, ".family");
if (family) family[0] = 0;
}
auto pkey = X509_get_pubkey (cert); auto pkey = X509_get_pubkey (cert);
int keyType = EVP_PKEY_type(pkey->type); int keyType = EVP_PKEY_type(pkey->type);
switch (keyType) switch (keyType)
@ -72,8 +77,8 @@ namespace data
LogPrint (eLogWarning, "Family: Certificate key type ", keyType, " is not supported"); LogPrint (eLogWarning, "Family: Certificate key type ", keyType, " is not supported");
} }
EVP_PKEY_free (pkey); EVP_PKEY_free (pkey);
if (verifier) if (verifier && cn)
m_SigningKeys[name] = verifier; m_SigningKeys[cn] = verifier;
} }
SSL_free (ssl); SSL_free (ssl);
} }

Loading…
Cancel
Save