mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-27 19:10:20 +01:00
add PKCS12 CA-cert friendly names extraction
This commit is contained in:
@@ -39,6 +39,7 @@ class Crypto_API PKCS12Container
|
||||
{
|
||||
public:
|
||||
typedef X509Certificate::List CAList;
|
||||
typedef std::vector<std::string> CANameList;
|
||||
|
||||
explicit PKCS12Container(std::istream& istr, const std::string& password = "");
|
||||
/// Creates the PKCS12Container object from a stream.
|
||||
@@ -84,8 +85,12 @@ public:
|
||||
const std::string& getFriendlyName() const;
|
||||
/// Returns the friendly name of the certificate bag.
|
||||
|
||||
const CANameList& getFriendlyNamesCA() const;
|
||||
/// Returns a list of CA certificates friendly names.
|
||||
|
||||
private:
|
||||
void load(PKCS12* pPKCS12, const std::string& password = "");
|
||||
std::string extractFriendlyName(X509* pCert);
|
||||
|
||||
#ifdef POCO_ENABLE_CPP11
|
||||
typedef std::unique_ptr<X509Certificate> CertPtr;
|
||||
@@ -97,7 +102,8 @@ private:
|
||||
EVP_PKEY* _pKey;
|
||||
CertPtr _pX509Cert;
|
||||
CAList _caCertList;
|
||||
std::string _pkcsFriendlyname;
|
||||
CANameList _caCertNames;
|
||||
std::string _pkcsFriendlyName;
|
||||
};
|
||||
|
||||
|
||||
@@ -121,7 +127,7 @@ inline const X509Certificate& PKCS12Container::getX509Certificate() const
|
||||
|
||||
inline const std::string& PKCS12Container::getFriendlyName() const
|
||||
{
|
||||
return _pkcsFriendlyname;
|
||||
return _pkcsFriendlyName;
|
||||
}
|
||||
|
||||
|
||||
@@ -131,6 +137,12 @@ inline const PKCS12Container::CAList& PKCS12Container::getCACerts() const
|
||||
}
|
||||
|
||||
|
||||
inline const PKCS12Container::CANameList& PKCS12Container::getFriendlyNamesCA() const
|
||||
{
|
||||
return _caCertNames;
|
||||
}
|
||||
|
||||
|
||||
inline bool PKCS12Container::hasKey() const
|
||||
{
|
||||
return _pKey != 0;
|
||||
|
||||
Reference in New Issue
Block a user