X.509 v.3 certificate. Encrypted certificates are not supported. Only X509KeyStorageFlags::DefaultKeySet flag is supported. Objects of this class should only be allocated using System::MakeObject() function. Never create instance of this type on stack or using operator new, as it will result in runtime errors and/or assertion faults. Always wrap this class into System::SmartPtr pointer and use this pointer to pass it to functions as argument. More...
#include "x509_certificate.h"
Inherits System::Object, and System::IDisposable.
Inherited by System::Security::Cryptography::X509Certificates::X509Certificate2.
Public Types | |
typedef SharedPtr< X509Certificate > | Ptr |
Pointer type. More... | |
![]() | |
typedef SmartPtr< Object > | ptr |
Alias for smart pointer type. More... | |
Public Member Functions | |
X509Certificate (const X509Certificate &)=delete | |
X509Certificate & | operator= (const X509Certificate &)=delete |
ASPOSECPP_SHARED_API | X509Certificate () |
Constructor. More... | |
ASPOSECPP_SHARED_API | X509Certificate (const ByteArrayPtr &data) |
Constructor. More... | |
ASPOSECPP_SHARED_API | X509Certificate (const String &filename) |
Constructor. More... | |
ASPOSECPP_SHARED_API | X509Certificate (const SharedPtr< X509Certificate > &cert) |
Constructor. More... | |
ASPOSECPP_SHARED_API | X509Certificate (const ByteArrayPtr &raw_data, const String &password) |
Constructor. More... | |
ASPOSECPP_SHARED_API | X509Certificate (const ByteArrayPtr &raw_data, const SecureStringPtr &password) |
Constructor. More... | |
ASPOSECPP_SHARED_API | X509Certificate (const String &filename, const String &password) |
Constructor. More... | |
ASPOSECPP_SHARED_API | X509Certificate (const String &filename, const SecureStringPtr &password) |
Constructor. More... | |
ASPOSECPP_SHARED_API | X509Certificate (const ByteArrayPtr &raw_data, const String &password, X509KeyStorageFlags key_storage_flags) |
Constructor. More... | |
ASPOSECPP_SHARED_API | X509Certificate (const ByteArrayPtr &raw_data, const SecureStringPtr &password, X509KeyStorageFlags key_storage_flags) |
Constructor. More... | |
ASPOSECPP_SHARED_API | X509Certificate (const String &filename, const String &password, X509KeyStorageFlags key_storage_flags) |
Constructor. More... | |
ASPOSECPP_SHARED_API | X509Certificate (const String &filename, const SecureStringPtr &password, X509KeyStorageFlags key_storage_flags) |
Constructor. More... | |
ASPOSECPP_SHARED_API | X509Certificate (const ByteArrayPtr &raw_data, const ByteArrayPtr &private_key, X509KeyStorageFlags key_storage_flags) |
Constructor. More... | |
ASPOSECPP_SHARED_API void | Dispose () override |
Does nothing. More... | |
ASPOSECPP_SHARED_API IntPtr | get_Handle () const |
Gets a handle to Microsoft Cryptographic API certificate context. More... | |
ASPOSECPP_SHARED_API String | get_Subject () const |
Gets subject distinguished name from certificate. More... | |
ASPOSECPP_SHARED_API String | get_Issuer () const |
Gets name of the certificate authority that issued the X.509v3 certificate. More... | |
virtual ASPOSECPP_SHARED_API ByteArrayPtr | GetCertHash () const |
Gets hash for the current object as an array of bytes. More... | |
virtual ASPOSECPP_SHARED_API ByteArrayPtr | GetCertHash (const HashAlgorithmName &hash_algorithm) const |
Gets hash for the current object as an array of bytes. More... | |
virtual ASPOSECPP_SHARED_API String | GetCertHashString () const |
Gets SHA1 hash for the current object as a hexadecimal string. More... | |
virtual ASPOSECPP_SHARED_API String | GetCertHashString (const HashAlgorithmName &hash_algorithm) const |
Gets SHA1 hash for the current object as a hexadecimal string. More... | |
virtual ASPOSECPP_SHARED_API String | GetEffectiveDateString () const |
Gets effective date of the current sertificate. More... | |
virtual ASPOSECPP_SHARED_API String | GetExpirationDateString () const |
Gets expiration date of the current sertificate. More... | |
virtual ASPOSECPP_SHARED_API String | GetFormat () const |
Gets name of the certificate format. More... | |
virtual ASPOSECPP_SHARED_API String | GetIssuerName () const |
Gets name of the certification authority that issued the current certificate. More... | |
virtual ASPOSECPP_SHARED_API String | GetKeyAlgorithm () const |
Gets key information for the current certificate as a string. More... | |
virtual ASPOSECPP_SHARED_API ByteArrayPtr | GetKeyAlgorithmParameters () const |
Gets key information for the current certificate as an array of bytes. More... | |
virtual ASPOSECPP_SHARED_API String | GetKeyAlgorithmParametersString () const |
Gets key information for the current certificate as a hexadecimal string. More... | |
virtual ASPOSECPP_SHARED_API String | GetName () const |
Gets name of the principal to witch the current sertificate was issued. More... | |
virtual ASPOSECPP_SHARED_API ByteArrayPtr | GetPublicKey () const |
Gets public key from certificate as array of bytes. More... | |
virtual ASPOSECPP_SHARED_API String | GetPublicKeyString () const |
Gets public key from certificate as a hexadecimal string. More... | |
virtual ASPOSECPP_SHARED_API ByteArrayPtr | GetRawCertData () const |
Gets raw data from certificate as array of bytes. More... | |
virtual ASPOSECPP_SHARED_API String | GetRawCertDataString () const |
Gets raw data from certificate as a hexadecimal string. More... | |
virtual ASPOSECPP_SHARED_API ByteArrayPtr | GetSerialNumber () const |
Gets serial number from certificate as array of bytes. More... | |
virtual ASPOSECPP_SHARED_API String | GetSerialNumberString () const |
Gets serial number from certificate as a hexadecimal string. More... | |
virtual ASPOSECPP_SHARED_API ByteArrayPtr | Export (X509ContentType content_type) const |
Exports the current object to a byte array using the specified format. NOT IMPLEMENTED. More... | |
virtual ASPOSECPP_SHARED_API ByteArrayPtr | Export (X509ContentType content_type, const SecureStringPtr &password) const |
Exports the current object to a byte array using the specified format. NOT IMPLEMENTED. More... | |
virtual ASPOSECPP_SHARED_API ByteArrayPtr | Export (X509ContentType content_type, const String &password) const |
Exports the current object to a byte array using the specified format. NOT IMPLEMENTED. More... | |
virtual ASPOSECPP_SHARED_API void | Import (const String &filename, const SecureStringPtr &password, X509KeyStorageFlags key_storage_flags) |
Imports information from the specified certificate file. NOT IMPLEMENTED. More... | |
virtual ASPOSECPP_SHARED_API void | Import (const String &filename, const String &password, X509KeyStorageFlags key_storage_flags) |
Imports information from the specified certificate file. NOT IMPLEMENTED. More... | |
virtual ASPOSECPP_SHARED_API void | Import (const ByteArrayPtr &data, const SecureStringPtr &password, X509KeyStorageFlags key_storage_flags) |
Imports information from the specified certificate data. NOT IMPLEMENTED. More... | |
virtual ASPOSECPP_SHARED_API void | Import (const ByteArrayPtr &data, const String &password, X509KeyStorageFlags key_storage_flags) |
Imports information from the specified certificate data. NOT IMPLEMENTED. More... | |
virtual ASPOSECPP_SHARED_API void | Import (const String &filename) |
Imports information from the specified certificate file. NOT IMPLEMENTED. More... | |
virtual ASPOSECPP_SHARED_API void | Import (const ByteArrayPtr &data) |
Imports information from the specified certificate data. NOT IMPLEMENTED. More... | |
virtual ASPOSECPP_SHARED_API void | Reset () |
Resets the certificate state. More... | |
ASPOSECPP_SHARED_API bool | Equals (SharedPtr< Object > obj) override |
Compares two certificates. More... | |
virtual ASPOSECPP_SHARED_API String | ToString (bool verbose) const |
Returns the certificate information in text format. More... | |
ASPOSECPP_SHARED_API String | ToString () const override |
Returns the certificate information in text format. More... | |
ASPOSECPP_SHARED_API int32_t | GetHashCode () const override |
Gets certificate hash code. More... | |
![]() | |
ASPOSECPP_SHARED_API | Object () |
Creates object. Initializes all internal data structures. More... | |
virtual ASPOSECPP_SHARED_API | ~Object () |
Destroys object. Frees all internal data structures. More... | |
ASPOSECPP_SHARED_API | Object (Object const &x) |
Copy constructor. Doesn't copy anything, really, just initializes new object and enables copy constructing subclasses. More... | |
Object & | operator= (Object const &x) |
Assignment operator. Doesn't copy anything, really, just initializes new object and enables copy constructing subclasses. More... | |
Object * | SharedRefAdded () |
Increments shared reference count. Shouldn't be called directly; instead, use smart pointers or ThisProtector. More... | |
int | SharedRefRemovedSafe () |
Decrements and returns shared reference count. Shouldn't be called directly; instead, use smart pointers or ThisProtector. More... | |
int | RemovedSharedRefs (int count) |
Decreases shared reference count by specified value. More... | |
Detail::SmartPtrCounter * | WeakRefAdded () |
Increments weak reference count. Shouldn't be called directly; instead, use smart pointers or ThisProtector. More... | |
void | WeakRefRemoved () |
Decrements weak reference count. Shouldn't be called directly; instead, use smart pointers or ThisProtector. More... | |
Detail::SmartPtrCounter * | GetCounter () |
Gets reference counter data structure associated with the object. More... | |
int | SharedCount () const |
Gets current value of shared reference counter. More... | |
ASPOSECPP_SHARED_API void | Lock () |
Implements C# lock() statement locking. Call directly or use LockContext sentry object. More... | |
ASPOSECPP_SHARED_API void | Unlock () |
Implements C# lock() statement unlocking. Call directly or use LockContext sentry object. More... | |
virtual ASPOSECPP_SHARED_API bool | Equals (ptr obj) |
Compares objects using C# Object.Equals semantics. More... | |
virtual ASPOSECPP_SHARED_API ptr | MemberwiseClone () const |
Analog of C# Object.MemberwiseClone() method. Enables cloning custom types. More... | |
virtual ASPOSECPP_SHARED_API const TypeInfo & | GetType () const |
Gets actual type of object. Analog of C# System.Object.GetType() call. More... | |
virtual ASPOSECPP_SHARED_API bool | Is (const TypeInfo &targetType) const |
Check if object represents an instance of type described by targetType. Analog of C# 'is' operator. More... | |
virtual ASPOSECPP_SHARED_API void | SetTemplateWeakPtr (uint32_t argument) |
Set n'th template argument a weak pointer (rather than shared). Allows switching pointers in containers to weak mode. More... | |
virtual ASPOSECPP_SHARED_API bool | FastCast (const Details::FastRttiBase &helper, void **out_ptr) const |
For internal purposes only. More... | |
template<> | |
bool | Equals (float const &objA, float const &objB) |
Emulates C#-style floating point comparison where two NaNs are considered equal even though according to IEC 60559:1989 NaN is not equal to any value, including NaN. More... | |
template<> | |
bool | Equals (double const &objA, double const &objB) |
Emulates C#-style floating point comparison where two NaNs are considered equal even though according to IEC 60559:1989 NaN is not equal to any value, including NaN. More... | |
template<> | |
bool | ReferenceEquals (String const &str, std::nullptr_t) |
Specialization of Object::ReferenceEquals for case of string and nullptr. More... | |
template<> | |
bool | ReferenceEquals (String const &str1, String const &str2) |
Specialization of Object::ReferenceEquals for case of strings. More... | |
Static Public Member Functions | |
static ASPOSECPP_SHARED_API SharedPtr< X509Certificate > | CreateFromCertFile (const String &filename) |
Creates sertificate from the specified PKCS7 file. More... | |
static ASPOSECPP_SHARED_API SharedPtr< X509Certificate > | CreateFromSignedFile (const String &filename) |
Creates sertificate from the specified signed file. More... | |
![]() | |
static bool | ReferenceEquals (ptr const &objA, ptr const &objB) |
Compares objects by reference. More... | |
template<typename T > | |
static std::enable_if<!IsSmartPtr< T >::value, bool >::type | ReferenceEquals (T const &objA, T const &objB) |
Compares objects by reference. More... | |
template<typename T > | |
static std::enable_if<!IsSmartPtr< T >::value, bool >::type | ReferenceEquals (T const &objA, std::nullptr_t) |
Reference-compares value type object with nullptr. More... | |
template<typename T1 , typename T2 > | |
static std::enable_if< IsSmartPtr< T1 >::value &&IsSmartPtr< T2 >::value, bool >::type | Equals (T1 const &objA, T2 const &objB) |
Compares reference type objects in C# style. More... | |
template<typename T1 , typename T2 > | |
static std::enable_if<!IsSmartPtr< T1 >::value &&!IsSmartPtr< T2 >::value, bool >::type | Equals (T1 const &objA, T2 const &objB) |
Compares value type objects in C# style. More... | |
static const TypeInfo & | Type () |
Implements C# typeof(System.Object) construct. More... | |
Protected Member Functions | |
ASPOSECPP_SHARED_API | ~X509Certificate () |
void | VerifyCertificateCreated () const |
ByteArrayPtr | GetRawCertHash () const |
ByteArrayPtr | GetRawKeyAlgorithmParameters () const |
ByteArrayPtr | GetRawPublicKey () const |
ByteArrayPtr | GetRawSerialNumber () const |
DateTime | GetNotBefore () const |
DateTime | GetNotAfter () const |
SharedPtr< X500DistinguishedName > | GetIssuerNameInternal () const |
SharedPtr< X500DistinguishedName > | GetSubjectNameInternal () const |
Static Protected Member Functions | |
static String | FormatDate (DateTime dt) |
Protected Attributes | |
const std::unique_ptr< Details::X509CertificateImpl > | m_pimpl |
Certificate implementation. More... | |
X.509 v.3 certificate. Encrypted certificates are not supported. Only X509KeyStorageFlags::DefaultKeySet flag is supported. Objects of this class should only be allocated using System::MakeObject() function. Never create instance of this type on stack or using operator new, as it will result in runtime errors and/or assertion faults. Always wrap this class into System::SmartPtr pointer and use this pointer to pass it to functions as argument.
typedef SharedPtr<X509Certificate> System::Security::Cryptography::X509Certificates::X509Certificate::Ptr |
Pointer type.
|
delete |
ASPOSECPP_SHARED_API System::Security::Cryptography::X509Certificates::X509Certificate::X509Certificate | ( | ) |
Constructor.
ASPOSECPP_SHARED_API System::Security::Cryptography::X509Certificates::X509Certificate::X509Certificate | ( | const ByteArrayPtr & | data | ) |
Constructor.
data | Sequence of bytes that represents encoded certificate. |
ASPOSECPP_SHARED_API System::Security::Cryptography::X509Certificates::X509Certificate::X509Certificate | ( | const String & | filename | ) |
Constructor.
filename | File to load certificate from. |
ASPOSECPP_SHARED_API System::Security::Cryptography::X509Certificates::X509Certificate::X509Certificate | ( | const SharedPtr< X509Certificate > & | cert | ) |
Constructor.
cert | A certificate used to initialize this object. |
ASPOSECPP_SHARED_API System::Security::Cryptography::X509Certificates::X509Certificate::X509Certificate | ( | const ByteArrayPtr & | raw_data, |
const String & | password | ||
) |
Constructor.
raw_data | Sequence of bytes that represents encoded certificate. |
password | Password used to access the certificate data. |
ASPOSECPP_SHARED_API System::Security::Cryptography::X509Certificates::X509Certificate::X509Certificate | ( | const ByteArrayPtr & | raw_data, |
const SecureStringPtr & | password | ||
) |
Constructor.
raw_data | Sequence of bytes that represents encoded certificate. |
password | Password used to access the certificate data. |
ASPOSECPP_SHARED_API System::Security::Cryptography::X509Certificates::X509Certificate::X509Certificate | ( | const String & | filename, |
const String & | password | ||
) |
Constructor.
filename | File to load certificate from. |
password | Password used to access the certificate data. |
ASPOSECPP_SHARED_API System::Security::Cryptography::X509Certificates::X509Certificate::X509Certificate | ( | const String & | filename, |
const SecureStringPtr & | password | ||
) |
Constructor.
filename | File to load certificate from. |
password | Password used to access the certificate data. |
ASPOSECPP_SHARED_API System::Security::Cryptography::X509Certificates::X509Certificate::X509Certificate | ( | const ByteArrayPtr & | raw_data, |
const String & | password, | ||
X509KeyStorageFlags | key_storage_flags | ||
) |
Constructor.
raw_data | Sequence of bytes that represents encoded certificate. |
password | Password used to access the certificate data. |
key_storage_flags | Flags indicating how to store key. |
ASPOSECPP_SHARED_API System::Security::Cryptography::X509Certificates::X509Certificate::X509Certificate | ( | const ByteArrayPtr & | raw_data, |
const SecureStringPtr & | password, | ||
X509KeyStorageFlags | key_storage_flags | ||
) |
Constructor.
raw_data | Sequence of bytes that represents encoded certificate. |
password | Password used to access the certificate data. |
key_storage_flags | Flags indicating how to store key. |
ASPOSECPP_SHARED_API System::Security::Cryptography::X509Certificates::X509Certificate::X509Certificate | ( | const String & | filename, |
const String & | password, | ||
X509KeyStorageFlags | key_storage_flags | ||
) |
Constructor.
filename | File to load certificate from. |
password | Password used to access the certificate data. |
key_storage_flags | Flags indicating how to store key. |
ASPOSECPP_SHARED_API System::Security::Cryptography::X509Certificates::X509Certificate::X509Certificate | ( | const String & | filename, |
const SecureStringPtr & | password, | ||
X509KeyStorageFlags | key_storage_flags | ||
) |
Constructor.
filename | File to load certificate from. |
password | Password used to access the certificate data. |
key_storage_flags | Flags indicating how to store key. |
ASPOSECPP_SHARED_API System::Security::Cryptography::X509Certificates::X509Certificate::X509Certificate | ( | const ByteArrayPtr & | raw_data, |
const ByteArrayPtr & | private_key, | ||
X509KeyStorageFlags | key_storage_flags | ||
) |
Constructor.
raw_data | Sequence of bytes that represents encoded certificate (public part). |
private_key | Sequence of bytes that represents private key. |
key_storage_flags | Flags indicating how to store key. |
|
protected |
|
static |
Creates sertificate from the specified PKCS7 file.
filename | Certificate file name. |
|
static |
Creates sertificate from the specified signed file.
filename | Certificate file name. |
|
overridevirtual |
Does nothing.
Reimplemented from System::IDisposable.
|
override |
Compares two certificates.
obj | Certificate to compare with current object. |
|
virtual |
Exports the current object to a byte array using the specified format. NOT IMPLEMENTED.
content_type | Specifies how to format the output data. |
|
virtual |
Exports the current object to a byte array using the specified format. NOT IMPLEMENTED.
content_type | Specifies how to format the output data. |
password | The password required to access certificate data. |
|
virtual |
Exports the current object to a byte array using the specified format. NOT IMPLEMENTED.
content_type | Specifies how to format the output data. |
password | The password required to access certificate data. |
|
staticprotected |
ASPOSECPP_SHARED_API IntPtr System::Security::Cryptography::X509Certificates::X509Certificate::get_Handle | ( | ) | const |
Gets a handle to Microsoft Cryptographic API certificate context.
ASPOSECPP_SHARED_API String System::Security::Cryptography::X509Certificates::X509Certificate::get_Issuer | ( | ) | const |
Gets name of the certificate authority that issued the X.509v3 certificate.
ASPOSECPP_SHARED_API String System::Security::Cryptography::X509Certificates::X509Certificate::get_Subject | ( | ) | const |
Gets subject distinguished name from certificate.
|
virtual |
Gets hash for the current object as an array of bytes.
|
virtual |
Gets hash for the current object as an array of bytes.
hash_algorithm | Hash algorithm name. |
|
virtual |
Gets SHA1 hash for the current object as a hexadecimal string.
|
virtual |
Gets SHA1 hash for the current object as a hexadecimal string.
hash_algorithm | Hash algorithm name. |
|
virtual |
Gets effective date of the current sertificate.
|
virtual |
Gets expiration date of the current sertificate.
|
virtual |
Gets name of the certificate format.
|
overridevirtual |
|
virtual |
Gets name of the certification authority that issued the current certificate.
|
protected |
|
virtual |
Gets key information for the current certificate as a string.
|
virtual |
Gets key information for the current certificate as an array of bytes.
|
virtual |
Gets key information for the current certificate as a hexadecimal string.
|
virtual |
Gets name of the principal to witch the current sertificate was issued.
|
protected |
|
protected |
|
virtual |
Gets public key from certificate as array of bytes.
|
virtual |
Gets public key from certificate as a hexadecimal string.
|
virtual |
Gets raw data from certificate as array of bytes.
|
virtual |
Gets raw data from certificate as a hexadecimal string.
|
protected |
|
protected |
|
protected |
|
protected |
|
virtual |
Gets serial number from certificate as array of bytes.
|
virtual |
Gets serial number from certificate as a hexadecimal string.
|
protected |
|
virtual |
Imports information from the specified certificate file. NOT IMPLEMENTED.
filename | The certificate file name. |
password | The password required to access the certificate data. |
key_storage_flags |
Reimplemented in System::Security::Cryptography::X509Certificates::X509Certificate2.
|
virtual |
Imports information from the specified certificate file. NOT IMPLEMENTED.
filename | The certificate file name. |
password | The password required to access the certificate data. |
key_storage_flags |
Reimplemented in System::Security::Cryptography::X509Certificates::X509Certificate2.
|
virtual |
Imports information from the specified certificate data. NOT IMPLEMENTED.
data | The X.509 certificate data. |
password | The password required to access the certificate data. |
key_storage_flags |
Reimplemented in System::Security::Cryptography::X509Certificates::X509Certificate2.
|
virtual |
Imports information from the specified certificate data. NOT IMPLEMENTED.
data | The certificate file name. |
password | The password required to access the certificate data. |
key_storage_flags |
Reimplemented in System::Security::Cryptography::X509Certificates::X509Certificate2.
|
virtual |
Imports information from the specified certificate file. NOT IMPLEMENTED.
filename | The certificate file name. |
Reimplemented in System::Security::Cryptography::X509Certificates::X509Certificate2.
|
virtual |
Imports information from the specified certificate data. NOT IMPLEMENTED.
data | The certificate file name. |
Reimplemented in System::Security::Cryptography::X509Certificates::X509Certificate2.
|
delete |
|
virtual |
Resets the certificate state.
Reimplemented in System::Security::Cryptography::X509Certificates::X509Certificate2.
|
virtual |
Returns the certificate information in text format.
verbose | true to display additional certificate information. |
Reimplemented in System::Security::Cryptography::X509Certificates::X509Certificate2.
|
overridevirtual |
Returns the certificate information in text format.
Reimplemented from System::Object.
Reimplemented in System::Security::Cryptography::X509Certificates::X509Certificate2.
|
protected |
|
protected |
Certificate implementation.