---
title: "System::Security::Cryptography::X509Certificates::X509Certificate2::get_HasPrivateKey method"
url: "https://reference.aspose.com/pub/cpp/system.security.cryptography.x509certificates/x509certificate2/get_hasprivatekey/"
product: "Aspose.PUB for C++"
description: "System::Security::Cryptography::X509Certificates::X509Certificate2::get_HasPrivateKey method. Checks whether the certificate has private key in C++."
---

## X509Certificate2::get_HasPrivateKey method


Checks whether the certificate has private key.

```cpp
bool System::Security::Cryptography::X509Certificates::X509Certificate2::get_HasPrivateKey() const
```


### ReturnValue

True if private key existst, false otherwise.

## See Also

* Class [X509Certificate2](../)
* Namespace [System::Security::Cryptography::X509Certificates](../../)
* Library [Aspose.PUB for C++](../../../)
