The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.
X500DistinguishedName Constructor (X500DistinguishedName^)
.NET Framework (current version)
Initializes a new instance of the X500DistinguishedName class using the specified X500DistinguishedName object.
Assembly: System (in System.dll)
Parameters
- distinguishedName
-
Type:
System.Security.Cryptography.X509Certificates::X500DistinguishedName^
An X500DistinguishedName object.
This constructor creates a copy of the specified X500DistinguishedName object. The X500DistinguishedName class inherits from the AsnEncodedData class.
The following code example shows how to use the X500DistinguishedName class.
#using <System.dll> #using <system.security.dll> using namespace System; using namespace System::Security::Cryptography; using namespace System::Security::Permissions; using namespace System::IO; using namespace System::Security::Cryptography::X509Certificates; int main() { try { X509Store ^ store = gcnew X509Store( "MY",StoreLocation::CurrentUser ); store->Open( static_cast<OpenFlags>(OpenFlags::ReadOnly | OpenFlags::OpenExistingOnly) ); X509Certificate2Collection ^ collection = dynamic_cast<X509Certificate2Collection^>(store->Certificates); X509Certificate2Collection ^ fcollection = dynamic_cast<X509Certificate2Collection^>(collection->Find( X509FindType::FindByTimeValid, DateTime::Now, false )); X509Certificate2Collection ^ scollection = X509Certificate2UI::SelectFromCollection(fcollection, "Test Certificate Select","Select a certificate from the following list to get information on that certificate",X509SelectionFlag::MultiSelection); Console::WriteLine( "Number of certificates: {0}{1}", scollection->Count, Environment::NewLine ); System::Collections::IEnumerator^ myEnum = scollection->GetEnumerator(); while ( myEnum->MoveNext() ) { X509Certificate2 ^ x509 = safe_cast<X509Certificate2 ^>(myEnum->Current); X500DistinguishedName ^ dname = gcnew X500DistinguishedName( x509->SubjectName ); Console::WriteLine( "X500DistinguishedName: {0}{1}", dname->Name, Environment::NewLine ); x509->Reset(); } store->Close(); } catch ( CryptographicException^ ) { Console::WriteLine( "Information could not be written out for this certificate." ); } }
.NET Framework
Available since 2.0
Available since 2.0
Show: