mirror of
https://github.com/pocoproject/poco.git
synced 2024-12-13 10:32:57 +01:00
fix(Crypto) Update method to extract friendlyName from certificate (#3787)
* fix(Crypto) Update method to extract friendlyName from certificate
This commit is contained in:
parent
49f6def959
commit
1fcbfc6094
@ -128,19 +128,12 @@ std::string PKCS12Container::extractFriendlyName(X509* pCert)
|
||||
std::string friendlyName;
|
||||
if(pCert)
|
||||
{
|
||||
STACK_OF(PKCS12_SAFEBAG)*pBags = 0;
|
||||
PKCS12_SAFEBAG*pBag = PKCS12_add_cert(&pBags, pCert);
|
||||
if(pBag)
|
||||
int length = 0;
|
||||
char* pBuffer = reinterpret_cast<char*>(X509_alias_get0(pCert, &length));
|
||||
if (pBuffer)
|
||||
{
|
||||
char* pBuffer = PKCS12_get_friendlyname(pBag);
|
||||
if(pBuffer)
|
||||
{
|
||||
friendlyName = pBuffer;
|
||||
OPENSSL_free(pBuffer);
|
||||
}
|
||||
if(pBags) sk_PKCS12_SAFEBAG_pop_free(pBags, PKCS12_SAFEBAG_free);
|
||||
friendlyName.append(pBuffer, length);
|
||||
}
|
||||
else throw OpenSSLException("PKCS12Container::extractFriendlyName()");
|
||||
}
|
||||
else throw NullPointerException("PKCS12Container::extractFriendlyName()");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user