X500DistinguishedName Konstruktoren
Definition
Wichtig
Einige Informationen beziehen sich auf Vorabversionen, die vor dem Release ggf. grundlegend überarbeitet werden. Microsoft übernimmt hinsichtlich der hier bereitgestellten Informationen keine Gewährleistungen, seien sie ausdrücklich oder konkludent.
Initialisiert eine neue Instanz der X500DistinguishedName-Klasse.
Überlädt
| Name | Beschreibung |
|---|---|
| X500DistinguishedName(Byte[]) |
Initialisiert eine neue Instanz der X500DistinguishedName Klasse mithilfe von Informationen aus dem angegebenen Bytearray. |
| X500DistinguishedName(ReadOnlySpan<Byte>) |
Initialisiert eine neue Instanz der X500DistinguishedName Klasse mithilfe von Informationen aus den bereitgestellten Daten. |
| X500DistinguishedName(AsnEncodedData) |
Initialisiert eine neue Instanz der X500DistinguishedName Klasse mithilfe des angegebenen AsnEncodedData Objekts. |
| X500DistinguishedName(X500DistinguishedName) |
Initialisiert eine neue Instanz der X500DistinguishedName Klasse mithilfe des angegebenen X500DistinguishedName Objekts. |
| X500DistinguishedName(String) |
Initialisiert eine neue Instanz der X500DistinguishedName Klasse mithilfe von Informationen aus der angegebenen Zeichenfolge. |
| X500DistinguishedName(String, X500DistinguishedNameFlags) |
Initialisiert eine neue Instanz der Klasse mithilfe der X500DistinguishedName angegebenen Zeichenfolge und X500DistinguishedNameFlags kennzeichnung. |
X500DistinguishedName(Byte[])
- Quelle:
- X500DistinguishedName.cs
- Quelle:
- X500DistinguishedName.cs
- Quelle:
- X500DistinguishedName.cs
- Quelle:
- X500DistinguishedName.cs
- Quelle:
- X500DistinguishedName.cs
Initialisiert eine neue Instanz der X500DistinguishedName Klasse mithilfe von Informationen aus dem angegebenen Bytearray.
public:
X500DistinguishedName(cli::array <System::Byte> ^ encodedDistinguishedName);
public X500DistinguishedName(byte[] encodedDistinguishedName);
new System.Security.Cryptography.X509Certificates.X500DistinguishedName : byte[] -> System.Security.Cryptography.X509Certificates.X500DistinguishedName
Public Sub New (encodedDistinguishedName As Byte())
Parameter
- encodedDistinguishedName
- Byte[]
Ein Bytearray, das Distinguished Name Information enthält.
Beispiele
Das folgende Codebeispiel zeigt, wie die X500DistinguishedName Klasse verwendet wird.
using System;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
class X500Sample
{
static void Main()
{
try
{
X509Store store = new("MY", StoreLocation.CurrentUser);
store.Open(OpenFlags.ReadOnly | OpenFlags.OpenExistingOnly);
X509Certificate2Collection collection = store.Certificates;
X509Certificate2Collection fcollection = 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: {scollection.Count}{Environment.NewLine}");
foreach (X509Certificate2 x509 in scollection)
{
X500DistinguishedName dname = new(
x509.SubjectName.Name,
X500DistinguishedNameFlags.Reversed | X500DistinguishedNameFlags.UseSemicolons
);
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.");
}
}
}
Imports System.Security.Cryptography.X509Certificates
Class X500Sample
Shared s_msg As String
Shared Sub Main()
Try
Dim store As New X509Store("MY", StoreLocation.CurrentUser)
store.Open(OpenFlags.ReadOnly Or OpenFlags.OpenExistingOnly)
Dim collection As X509Certificate2Collection = store.Certificates
Dim fcollection As X509Certificate2Collection = collection.Find(X509FindType.FindByTimeValid, Date.Now, False)
Dim scollection As X509Certificate2Collection = X509Certificate2UI.SelectFromCollection(
fcollection,
"Test Certificate Select",
"Select a certificate from the following list to get information on that certificate",
X509SelectionFlag.MultiSelection
)
s_msg = "Number of certificates: " & scollection.Count & Environment.NewLine
Console.WriteLine(s_msg)
Dim x509 As X509Certificate2
For Each x509 In scollection
Dim dname As New X500DistinguishedName(
x509.SubjectName.Name,
X500DistinguishedNameFlags.Reversed Or X500DistinguishedNameFlags.UseSemicolons
)
s_msg = "X500DistinguishedName: " & dname.Name & Environment.NewLine
Console.WriteLine(s_msg)
x509.Reset()
Next x509
store.Close()
Catch e As Exception
s_msg = "Error: Information could not be written out for this certificate."
Console.WriteLine(s_msg)
End Try
End Sub
End Class
Hinweise
Die X500DistinguishedName Klasse erbt von der AsnEncodedData Klasse.
Gilt für:
X500DistinguishedName(ReadOnlySpan<Byte>)
- Quelle:
- X500DistinguishedName.cs
- Quelle:
- X500DistinguishedName.cs
- Quelle:
- X500DistinguishedName.cs
- Quelle:
- X500DistinguishedName.cs
- Quelle:
- X500DistinguishedName.cs
Initialisiert eine neue Instanz der X500DistinguishedName Klasse mithilfe von Informationen aus den bereitgestellten Daten.
public:
X500DistinguishedName(ReadOnlySpan<System::Byte> encodedDistinguishedName);
public X500DistinguishedName(ReadOnlySpan<byte> encodedDistinguishedName);
new System.Security.Cryptography.X509Certificates.X500DistinguishedName : ReadOnlySpan<byte> -> System.Security.Cryptography.X509Certificates.X500DistinguishedName
Public Sub New (encodedDistinguishedName As ReadOnlySpan(Of Byte))
Parameter
- encodedDistinguishedName
- ReadOnlySpan<Byte>
Der codierte Distinguished Name.
Gilt für:
X500DistinguishedName(AsnEncodedData)
- Quelle:
- X500DistinguishedName.cs
- Quelle:
- X500DistinguishedName.cs
- Quelle:
- X500DistinguishedName.cs
- Quelle:
- X500DistinguishedName.cs
- Quelle:
- X500DistinguishedName.cs
Initialisiert eine neue Instanz der X500DistinguishedName Klasse mithilfe des angegebenen AsnEncodedData Objekts.
public:
X500DistinguishedName(System::Security::Cryptography::AsnEncodedData ^ encodedDistinguishedName);
public X500DistinguishedName(System.Security.Cryptography.AsnEncodedData encodedDistinguishedName);
new System.Security.Cryptography.X509Certificates.X500DistinguishedName : System.Security.Cryptography.AsnEncodedData -> System.Security.Cryptography.X509Certificates.X500DistinguishedName
Public Sub New (encodedDistinguishedName As AsnEncodedData)
Parameter
- encodedDistinguishedName
- AsnEncodedData
Ein AsnEncodedData Objekt, das den distinguishierten Namen darstellt.
Beispiele
Das folgende Codebeispiel zeigt, wie die X500DistinguishedName Klasse verwendet wird.
using System;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
class X500Sample
{
static void Main()
{
try
{
X509Store store = new("MY", StoreLocation.CurrentUser);
store.Open(OpenFlags.ReadOnly | OpenFlags.OpenExistingOnly);
X509Certificate2Collection collection = store.Certificates;
X509Certificate2Collection fcollection = 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: {scollection.Count}{Environment.NewLine}");
foreach (X509Certificate2 x509 in scollection)
{
X500DistinguishedName dname = new(
x509.SubjectName.Name,
X500DistinguishedNameFlags.Reversed | X500DistinguishedNameFlags.UseSemicolons
);
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.");
}
}
}
Imports System.Security.Cryptography.X509Certificates
Class X500Sample
Shared s_msg As String
Shared Sub Main()
Try
Dim store As New X509Store("MY", StoreLocation.CurrentUser)
store.Open(OpenFlags.ReadOnly Or OpenFlags.OpenExistingOnly)
Dim collection As X509Certificate2Collection = store.Certificates
Dim fcollection As X509Certificate2Collection = collection.Find(X509FindType.FindByTimeValid, Date.Now, False)
Dim scollection As X509Certificate2Collection = X509Certificate2UI.SelectFromCollection(
fcollection,
"Test Certificate Select",
"Select a certificate from the following list to get information on that certificate",
X509SelectionFlag.MultiSelection
)
s_msg = "Number of certificates: " & scollection.Count & Environment.NewLine
Console.WriteLine(s_msg)
Dim x509 As X509Certificate2
For Each x509 In scollection
Dim dname As New X500DistinguishedName(
x509.SubjectName.Name,
X500DistinguishedNameFlags.Reversed Or X500DistinguishedNameFlags.UseSemicolons
)
s_msg = "X500DistinguishedName: " & dname.Name & Environment.NewLine
Console.WriteLine(s_msg)
x509.Reset()
Next x509
store.Close()
Catch e As Exception
s_msg = "Error: Information could not be written out for this certificate."
Console.WriteLine(s_msg)
End Try
End Sub
End Class
Hinweise
Die X500DistinguishedName Klasse erbt von der AsnEncodedData Klasse.
Gilt für:
X500DistinguishedName(X500DistinguishedName)
- Quelle:
- X500DistinguishedName.cs
- Quelle:
- X500DistinguishedName.cs
- Quelle:
- X500DistinguishedName.cs
- Quelle:
- X500DistinguishedName.cs
- Quelle:
- X500DistinguishedName.cs
Initialisiert eine neue Instanz der X500DistinguishedName Klasse mithilfe des angegebenen X500DistinguishedName Objekts.
public:
X500DistinguishedName(System::Security::Cryptography::X509Certificates::X500DistinguishedName ^ distinguishedName);
public X500DistinguishedName(System.Security.Cryptography.X509Certificates.X500DistinguishedName distinguishedName);
new System.Security.Cryptography.X509Certificates.X500DistinguishedName : System.Security.Cryptography.X509Certificates.X500DistinguishedName -> System.Security.Cryptography.X509Certificates.X500DistinguishedName
Public Sub New (distinguishedName As X500DistinguishedName)
Parameter
- distinguishedName
- X500DistinguishedName
Ein X500DistinguishedName-Objekt.
Beispiele
Das folgende Codebeispiel zeigt, wie die X500DistinguishedName Klasse verwendet wird.
using System;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
class X500Sample
{
static void Main()
{
try
{
X509Store store = new("MY", StoreLocation.CurrentUser);
store.Open(OpenFlags.ReadOnly | OpenFlags.OpenExistingOnly);
X509Certificate2Collection collection = store.Certificates;
X509Certificate2Collection fcollection = 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: {scollection.Count}{Environment.NewLine}");
foreach (X509Certificate2 x509 in scollection)
{
X500DistinguishedName dname = new(
x509.SubjectName.Name,
X500DistinguishedNameFlags.Reversed | X500DistinguishedNameFlags.UseSemicolons
);
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.");
}
}
}
Imports System.Security.Cryptography.X509Certificates
Class X500Sample
Shared s_msg As String
Shared Sub Main()
Try
Dim store As New X509Store("MY", StoreLocation.CurrentUser)
store.Open(OpenFlags.ReadOnly Or OpenFlags.OpenExistingOnly)
Dim collection As X509Certificate2Collection = store.Certificates
Dim fcollection As X509Certificate2Collection = collection.Find(X509FindType.FindByTimeValid, Date.Now, False)
Dim scollection As X509Certificate2Collection = X509Certificate2UI.SelectFromCollection(
fcollection,
"Test Certificate Select",
"Select a certificate from the following list to get information on that certificate",
X509SelectionFlag.MultiSelection
)
s_msg = "Number of certificates: " & scollection.Count & Environment.NewLine
Console.WriteLine(s_msg)
Dim x509 As X509Certificate2
For Each x509 In scollection
Dim dname As New X500DistinguishedName(
x509.SubjectName.Name,
X500DistinguishedNameFlags.Reversed Or X500DistinguishedNameFlags.UseSemicolons
)
s_msg = "X500DistinguishedName: " & dname.Name & Environment.NewLine
Console.WriteLine(s_msg)
x509.Reset()
Next x509
store.Close()
Catch e As Exception
s_msg = "Error: Information could not be written out for this certificate."
Console.WriteLine(s_msg)
End Try
End Sub
End Class
Hinweise
Dieser Konstruktor erstellt eine Kopie des angegebenen X500DistinguishedName Objekts. Die X500DistinguishedName Klasse erbt von der AsnEncodedData Klasse.
Gilt für:
X500DistinguishedName(String)
- Quelle:
- X500DistinguishedName.cs
- Quelle:
- X500DistinguishedName.cs
- Quelle:
- X500DistinguishedName.cs
- Quelle:
- X500DistinguishedName.cs
- Quelle:
- X500DistinguishedName.cs
Initialisiert eine neue Instanz der X500DistinguishedName Klasse mithilfe von Informationen aus der angegebenen Zeichenfolge.
public:
X500DistinguishedName(System::String ^ distinguishedName);
public X500DistinguishedName(string distinguishedName);
new System.Security.Cryptography.X509Certificates.X500DistinguishedName : string -> System.Security.Cryptography.X509Certificates.X500DistinguishedName
Public Sub New (distinguishedName As String)
Parameter
- distinguishedName
- String
Eine Zeichenfolge, die den distinguishierten Namen darstellt.
Beispiele
Das folgende Codebeispiel zeigt, wie die X500DistinguishedName Klasse verwendet wird.
using System;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
class X500Sample
{
static void Main()
{
try
{
X509Store store = new("MY", StoreLocation.CurrentUser);
store.Open(OpenFlags.ReadOnly | OpenFlags.OpenExistingOnly);
X509Certificate2Collection collection = store.Certificates;
X509Certificate2Collection fcollection = 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: {scollection.Count}{Environment.NewLine}");
foreach (X509Certificate2 x509 in scollection)
{
X500DistinguishedName dname = new(
x509.SubjectName.Name,
X500DistinguishedNameFlags.Reversed | X500DistinguishedNameFlags.UseSemicolons
);
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.");
}
}
}
Imports System.Security.Cryptography.X509Certificates
Class X500Sample
Shared s_msg As String
Shared Sub Main()
Try
Dim store As New X509Store("MY", StoreLocation.CurrentUser)
store.Open(OpenFlags.ReadOnly Or OpenFlags.OpenExistingOnly)
Dim collection As X509Certificate2Collection = store.Certificates
Dim fcollection As X509Certificate2Collection = collection.Find(X509FindType.FindByTimeValid, Date.Now, False)
Dim scollection As X509Certificate2Collection = X509Certificate2UI.SelectFromCollection(
fcollection,
"Test Certificate Select",
"Select a certificate from the following list to get information on that certificate",
X509SelectionFlag.MultiSelection
)
s_msg = "Number of certificates: " & scollection.Count & Environment.NewLine
Console.WriteLine(s_msg)
Dim x509 As X509Certificate2
For Each x509 In scollection
Dim dname As New X500DistinguishedName(
x509.SubjectName.Name,
X500DistinguishedNameFlags.Reversed Or X500DistinguishedNameFlags.UseSemicolons
)
s_msg = "X500DistinguishedName: " & dname.Name & Environment.NewLine
Console.WriteLine(s_msg)
x509.Reset()
Next x509
store.Close()
Catch e As Exception
s_msg = "Error: Information could not be written out for this certificate."
Console.WriteLine(s_msg)
End Try
End Sub
End Class
Hinweise
Die X500DistinguishedName Klasse erbt von der AsnEncodedData Klasse.
Gilt für:
X500DistinguishedName(String, X500DistinguishedNameFlags)
- Quelle:
- X500DistinguishedName.cs
- Quelle:
- X500DistinguishedName.cs
- Quelle:
- X500DistinguishedName.cs
- Quelle:
- X500DistinguishedName.cs
- Quelle:
- X500DistinguishedName.cs
Initialisiert eine neue Instanz der Klasse mithilfe der X500DistinguishedName angegebenen Zeichenfolge und X500DistinguishedNameFlags kennzeichnung.
public:
X500DistinguishedName(System::String ^ distinguishedName, System::Security::Cryptography::X509Certificates::X500DistinguishedNameFlags flag);
public X500DistinguishedName(string distinguishedName, System.Security.Cryptography.X509Certificates.X500DistinguishedNameFlags flag);
new System.Security.Cryptography.X509Certificates.X500DistinguishedName : string * System.Security.Cryptography.X509Certificates.X500DistinguishedNameFlags -> System.Security.Cryptography.X509Certificates.X500DistinguishedName
Public Sub New (distinguishedName As String, flag As X500DistinguishedNameFlags)
Parameter
- distinguishedName
- String
Eine Zeichenfolge, die den distinguishierten Namen darstellt.
Eine bitweise Kombination der Enumerationswerte, die die Merkmale des unterschiedenen Namens angeben.
Beispiele
Das folgende Codebeispiel zeigt, wie die X500DistinguishedName Klasse verwendet wird.
using System;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
class X500Sample
{
static void Main()
{
try
{
X509Store store = new("MY", StoreLocation.CurrentUser);
store.Open(OpenFlags.ReadOnly | OpenFlags.OpenExistingOnly);
X509Certificate2Collection collection = store.Certificates;
X509Certificate2Collection fcollection = 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: {scollection.Count}{Environment.NewLine}");
foreach (X509Certificate2 x509 in scollection)
{
X500DistinguishedName dname = new(
x509.SubjectName.Name,
X500DistinguishedNameFlags.Reversed | X500DistinguishedNameFlags.UseSemicolons
);
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.");
}
}
}
Imports System.Security.Cryptography.X509Certificates
Class X500Sample
Shared s_msg As String
Shared Sub Main()
Try
Dim store As New X509Store("MY", StoreLocation.CurrentUser)
store.Open(OpenFlags.ReadOnly Or OpenFlags.OpenExistingOnly)
Dim collection As X509Certificate2Collection = store.Certificates
Dim fcollection As X509Certificate2Collection = collection.Find(X509FindType.FindByTimeValid, Date.Now, False)
Dim scollection As X509Certificate2Collection = X509Certificate2UI.SelectFromCollection(
fcollection,
"Test Certificate Select",
"Select a certificate from the following list to get information on that certificate",
X509SelectionFlag.MultiSelection
)
s_msg = "Number of certificates: " & scollection.Count & Environment.NewLine
Console.WriteLine(s_msg)
Dim x509 As X509Certificate2
For Each x509 In scollection
Dim dname As New X500DistinguishedName(
x509.SubjectName.Name,
X500DistinguishedNameFlags.Reversed Or X500DistinguishedNameFlags.UseSemicolons
)
s_msg = "X500DistinguishedName: " & dname.Name & Environment.NewLine
Console.WriteLine(s_msg)
x509.Reset()
Next x509
store.Close()
Catch e As Exception
s_msg = "Error: Information could not be written out for this certificate."
Console.WriteLine(s_msg)
End Try
End Sub
End Class
Hinweise
Die X500DistinguishedName Klasse erbt von der AsnEncodedData Klasse.