X509Certificate2

X509Certificate2 class

Represents X509 certificate. 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.

class X509Certificate2 : public System::Security::Cryptography::X509Certificates::X509Certificate

Methods

MethodDescription
static SharedPtr<X509Certificate> CreateFromCertFile(const String&)Creates sertificate from the specified PKCS7 file.
static SharedPtr<X509Certificate> CreateFromSignedFile(const String&)Creates sertificate from the specified signed file.
void Dispose() overrideDoes nothing.
bool Equals(SharedPtr<Object>) overrideCompares two certificates.
virtual bool Equals(ptr)Compares objects using C# Object.Equals semantics.
static std::enable_if<IsSmartPtr<T1>::value&&IsSmartPtr<T2>::value, bool>::type Equals(T1 const&, T2 const&)Compares reference type objects in C# style.
static bool Equals(float const&, float const&)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.
static bool Equals(double const&, double const&)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.
virtual ByteArrayPtr Export(X509ContentType) constExports the current object to a byte array using the specified format. NOT IMPLEMENTED.
virtual ByteArrayPtr Export(X509ContentType, const SecureStringPtr&) constExports the current object to a byte array using the specified format. NOT IMPLEMENTED.
virtual ByteArrayPtr Export(X509ContentType, const String&) constExports the current object to a byte array using the specified format. NOT IMPLEMENTED.
virtual bool FastCast(const Details::FastRttiBase&, void **) constFor internal purposes only.
bool get_Archived() constGets a value indicating that certificate is archived.
X509ExtensionCollectionPtr get_Extensions() constGets collection of extension objects associated with certificate.
String get_FriendlyName() constGets the certificate’s friendly name.
IntPtr get_Handle() constGets a handle to Microsoft Cryptographic API certificate context.
bool get_HasPrivateKey() constChecks whether the certificate has private key.
String get_Issuer() constGets name of the certificate authority that issued the X.509v3 certificate.
SharedPtr<X500DistinguishedName> get_IssuerName() constGets the name of party that issued a certificate.
DateTime get_NotAfter() constGets the local date and time after which a certificate is no longer valid.
DateTime get_NotBefore() constGets the local date and time on which a certificate becomes valid.
SharedPtr<AsymmetricAlgorithm> get_PrivateKey() constGets private key associated with certificate.
SharedPtr<PublicKey> get_PublicKey() constGets a sertificate PublicKey object.
ByteArrayPtr get_RawData() constGets certificate raw data.
String get_SerialNumber() constGets the serial number of a certificate.
SharedPtr<Oid> get_SignatureAlgorithm() constGets algorithm used to create signature of a certificate.
String get_Subject() constGets subject distinguished name from certificate.
SharedPtr<X500DistinguishedName> get_SubjectName() constGets the subject name from a certificate.
String get_Thumbprint() constGets the certificate thumbprint.
int32_t get_Version() constGets certificate format version.
static X509ContentType GetCertContentType(const ByteArrayPtr&)Gets the type of certificate contained in the specified byte array.
static X509ContentType GetCertContentType(const String&)Gets the type of certificate contained in the specified file.
virtual ByteArrayPtr GetCertHash() constGets hash for the current object as an array of bytes.
virtual ByteArrayPtr GetCertHash(const HashAlgorithmName&) constGets hash for the current object as an array of bytes.
virtual String GetCertHashString() constGets SHA1 hash for the current object as a hexadecimal string.
virtual String GetCertHashString(const HashAlgorithmName&) constGets SHA1 hash for the current object as a hexadecimal string.
Detail::SmartPtrCounter * GetCounter()Gets reference counter data structure associated with the object.
SharedPtr<DSA> GetDSAPrivateKey() constGets RSA private key;.
SharedPtr<DSA> GetDSAPublicKey() constGets RSA public key.
SharedPtr<ECDsa> GetECDsaPrivateKey() constGets RSA private key;.
SharedPtr<ECDsa> GetECDsaPublicKey() constGets RSA public key.
virtual String GetEffectiveDateString() constGets effective date of the current sertificate.
virtual String GetExpirationDateString() constGets expiration date of the current sertificate.
virtual String GetFormat() constGets name of the certificate format.
int32_t GetHashCode() const overrideGets certificate hash code.
virtual String GetIssuerName() constGets name of the certification authority that issued the current certificate.
virtual String GetKeyAlgorithm() constGets key information for the current certificate as a string.
virtual ByteArrayPtr GetKeyAlgorithmParameters() constGets key information for the current certificate as an array of bytes.
virtual String GetKeyAlgorithmParametersString() constGets key information for the current certificate as a hexadecimal string.
virtual String GetName() constGets name of the principal to witch the current sertificate was issued.
String GetNameInfo(X509NameType, bool) constGets subject or issuer name from certificate.
virtual ByteArrayPtr GetPublicKey() constGets public key from certificate as array of bytes.
virtual String GetPublicKeyString() constGets public key from certificate as a hexadecimal string.
virtual ByteArrayPtr GetRawCertData() constGets raw data from certificate as array of bytes.
virtual String GetRawCertDataString() constGets raw data from certificate as a hexadecimal string.
SharedPtr<RSA> GetRSAPrivateKey() constGets RSA private key;.
SharedPtr<RSA> GetRSAPublicKey() constGets RSA public key.
virtual ByteArrayPtr GetSerialNumber() constGets serial number from certificate as array of bytes.
virtual String GetSerialNumberString() constGets serial number from certificate as a hexadecimal string.
virtual const TypeInfo& GetType() constGets actual type of object. Analog of C# System.Object.GetType() call.
void Import(const String&, const SecureStringPtr&, X509KeyStorageFlags) overrideImports information from the specified certificate file.
void Import(const String&, const String&, X509KeyStorageFlags) overrideImports information from the specified certificate file.
void Import(const ByteArrayPtr&, const SecureStringPtr&, X509KeyStorageFlags) overrideImports information from the specified certificate data.
void Import(const ByteArrayPtr&, const String&, X509KeyStorageFlags) overrideImports information from the specified certificate data.
void Import(const String&) overrideImports information from the specified certificate file.
void Import(const ByteArrayPtr&) overrideImports information from the specified certificate data.
virtual bool Is(const TypeInfo&) constCheck if object represents an instance of type described by targetType. Analog of C# ‘is’ operator.
void Lock()Implements C# lock() statement locking. Call directly or use LockContext sentry object.
virtual ptr MemberwiseClone() constAnalog of C# Object.MemberwiseClone() method. Enables cloning custom types.
Object()Creates object. Initializes all internal data structures.
Object(Object const&)Copy constructor. Doesn’t copy anything, really, just initializes new object and enables copy constructing subclasses.
X509Certificate& operator=(const X509Certificate&)
Object& operator=(Object const&)Assignment operator. Doesn’t copy anything, really, just initializes new object and enables copy constructing subclasses.
static bool ReferenceEquals(ptr const&, ptr const&)Compares objects by reference.
static std::enable_if<!IsSmartPtr<T>::value, bool>::type ReferenceEquals(T const&, T const&)Compares objects by reference.
static std::enable_if<!IsSmartPtr<T>::value, bool>::type ReferenceEquals(T const&, std::nullptr_t)Reference-compares value type object with nullptr.
bool ReferenceEquals(String const&, std::nullptr_t)Specialization of Object::ReferenceEquals for case of string and nullptr.
bool ReferenceEquals(String const&, String const&)Specialization of Object::ReferenceEquals for case of strings.
int RemovedSharedRefs(int)Decreases shared reference count by specified value.
void Reset() overrideResets the certificate state.
void set_Archived(bool) constSets a value indicating that certificate is archived.
void set_FriendlyName(const String&)Sets the certificate’s friendly name.
void set_PrivateKey(const SharedPtr<AsymmetricAlgorithm>&)Sets or clears private key associated with certificate.
virtual void SetTemplateWeakPtr(uint32_t)Set n’th template argument a weak pointer (rather than shared). Allows switching pointers in containers to weak mode.
int SharedCount() constGets current value of shared reference counter.
Object * SharedRefAdded()Increments shared reference count. Shouldn’t be called directly; instead, use smart pointers or ThisProtector.
int SharedRefRemovedSafe()Decrements and returns shared reference count. Shouldn’t be called directly; instead, use smart pointers or ThisProtector.
String ToString(bool) const overrideReturns the certificate information in text format.
String ToString() const overrideReturns the certificate information in text format.
static const TypeInfo& Type()Implements C# typeof(System.Object) construct.
void Unlock()Implements C# lock() statement unlocking. Call directly or use LockContext sentry object.
bool Verify() constVerifies certificate chain.
Detail::SmartPtrCounter * WeakRefAdded()Increments weak reference count. Shouldn’t be called directly; instead, use smart pointers or ThisProtector.
void WeakRefRemoved()Decrements weak reference count. Shouldn’t be called directly; instead, use smart pointers or ThisProtector.
X509Certificate(const X509Certificate&)
X509Certificate()Constructor.
X509Certificate(const ByteArrayPtr&)Constructor.
X509Certificate(const String&)Constructor.
X509Certificate(const SharedPtr<X509Certificate>&)Constructor.
X509Certificate(const ByteArrayPtr&, const String&)Constructor.
X509Certificate(const ByteArrayPtr&, const SecureStringPtr&)Constructor.
X509Certificate(const String&, const String&)Constructor.
X509Certificate(const String&, const SecureStringPtr&)Constructor.
X509Certificate(const ByteArrayPtr&, const String&, X509KeyStorageFlags)Constructor.
X509Certificate(const ByteArrayPtr&, const SecureStringPtr&, X509KeyStorageFlags)Constructor.
X509Certificate(const String&, const String&, X509KeyStorageFlags)Constructor.
X509Certificate(const String&, const SecureStringPtr&, X509KeyStorageFlags)Constructor.
X509Certificate(const ByteArrayPtr&, const ByteArrayPtr&, X509KeyStorageFlags)Constructor.
X509Certificate2()Constructs empty X509Certificate2.
X509Certificate2(const String&)Constructor.
X509Certificate2(const SharedPtr<X509Certificate>&)Constructor.
X509Certificate2(const ByteArrayPtr&)Constructor.
X509Certificate2(const ByteArrayPtr&, const String&)Constructor.
X509Certificate2(const ByteArrayPtr&, const SecureStringPtr&)Constructor.
X509Certificate2(const ByteArrayPtr&, const String&, X509KeyStorageFlags)Constructor.
X509Certificate2(const ByteArrayPtr&, const SecureStringPtr&, X509KeyStorageFlags)Constructor.
X509Certificate2(const String&, const String&)Constructor.
X509Certificate2(const String&, const SecureStringPtr&)Constructor.
X509Certificate2(const String&, const String&, X509KeyStorageFlags)Constructor.
X509Certificate2(const String&, const SecureStringPtr&, X509KeyStorageFlags)Constructor.
X509Certificate2(const ByteArrayPtr&, const ByteArrayPtr&, X509KeyStorageFlags)Constructor.
virtual ~Object()Destroys object. Frees all internal data structures.

See Also