X500DistinguishedName Konstruktorer
Definition
Viktigt
En del information gäller för förhandsversionen av en produkt och kan komma att ändras avsevärt innan produkten blir allmänt tillgänglig. Microsoft lämnar inga garantier, uttryckliga eller underförstådda, avseende informationen som visas här.
Initierar en ny instans av X500DistinguishedName klassen.
Överlagringar
| Name | Description |
|---|---|
| X500DistinguishedName(Byte[]) |
Initierar en ny instans av klassen med hjälp av X500DistinguishedName information från den angivna bytematrisen. |
| X500DistinguishedName(ReadOnlySpan<Byte>) |
Initierar en ny instans av klassen med hjälp av X500DistinguishedName information från angivna data. |
| X500DistinguishedName(AsnEncodedData) |
Initierar en ny instans av X500DistinguishedName klassen med det angivna AsnEncodedData objektet. |
| X500DistinguishedName(X500DistinguishedName) |
Initierar en ny instans av X500DistinguishedName klassen med det angivna X500DistinguishedName objektet. |
| X500DistinguishedName(String) |
Initierar en ny instans av klassen med hjälp av X500DistinguishedName information från den angivna strängen. |
| X500DistinguishedName(String, X500DistinguishedNameFlags) |
Initierar en ny instans av X500DistinguishedName klassen med den angivna strängen och X500DistinguishedNameFlags flaggan. |
X500DistinguishedName(Byte[])
- Källa:
- X500DistinguishedName.cs
- Källa:
- X500DistinguishedName.cs
- Källa:
- X500DistinguishedName.cs
- Källa:
- X500DistinguishedName.cs
- Källa:
- X500DistinguishedName.cs
Initierar en ny instans av klassen med hjälp av X500DistinguishedName information från den angivna bytematrisen.
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())
Parametrar
- encodedDistinguishedName
- Byte[]
En bytematris som innehåller information om unika namn.
Exempel
I följande kodexempel visas hur du X500DistinguishedName använder klassen.
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
Kommentarer
Klassen X500DistinguishedName ärver från AsnEncodedData klassen.
Gäller för
X500DistinguishedName(ReadOnlySpan<Byte>)
- Källa:
- X500DistinguishedName.cs
- Källa:
- X500DistinguishedName.cs
- Källa:
- X500DistinguishedName.cs
- Källa:
- X500DistinguishedName.cs
- Källa:
- X500DistinguishedName.cs
Initierar en ny instans av klassen med hjälp av X500DistinguishedName information från angivna data.
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))
Parametrar
- encodedDistinguishedName
- ReadOnlySpan<Byte>
Det kodade unika namnet.
Gäller för
X500DistinguishedName(AsnEncodedData)
- Källa:
- X500DistinguishedName.cs
- Källa:
- X500DistinguishedName.cs
- Källa:
- X500DistinguishedName.cs
- Källa:
- X500DistinguishedName.cs
- Källa:
- X500DistinguishedName.cs
Initierar en ny instans av X500DistinguishedName klassen med det angivna AsnEncodedData objektet.
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)
Parametrar
- encodedDistinguishedName
- AsnEncodedData
Ett AsnEncodedData objekt som representerar det unika namnet.
Exempel
I följande kodexempel visas hur du X500DistinguishedName använder klassen.
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
Kommentarer
Klassen X500DistinguishedName ärver från AsnEncodedData klassen.
Gäller för
X500DistinguishedName(X500DistinguishedName)
- Källa:
- X500DistinguishedName.cs
- Källa:
- X500DistinguishedName.cs
- Källa:
- X500DistinguishedName.cs
- Källa:
- X500DistinguishedName.cs
- Källa:
- X500DistinguishedName.cs
Initierar en ny instans av X500DistinguishedName klassen med det angivna X500DistinguishedName objektet.
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)
Parametrar
- distinguishedName
- X500DistinguishedName
Ett X500DistinguishedName objekt.
Exempel
I följande kodexempel visas hur du X500DistinguishedName använder klassen.
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
Kommentarer
Den här konstruktorn skapar en kopia av det angivna X500DistinguishedName objektet. Klassen X500DistinguishedName ärver från AsnEncodedData klassen.
Gäller för
X500DistinguishedName(String)
- Källa:
- X500DistinguishedName.cs
- Källa:
- X500DistinguishedName.cs
- Källa:
- X500DistinguishedName.cs
- Källa:
- X500DistinguishedName.cs
- Källa:
- X500DistinguishedName.cs
Initierar en ny instans av klassen med hjälp av X500DistinguishedName information från den angivna strängen.
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)
Parametrar
- distinguishedName
- String
En sträng som representerar det unika namnet.
Exempel
I följande kodexempel visas hur du X500DistinguishedName använder klassen.
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
Kommentarer
Klassen X500DistinguishedName ärver från AsnEncodedData klassen.
Gäller för
X500DistinguishedName(String, X500DistinguishedNameFlags)
- Källa:
- X500DistinguishedName.cs
- Källa:
- X500DistinguishedName.cs
- Källa:
- X500DistinguishedName.cs
- Källa:
- X500DistinguishedName.cs
- Källa:
- X500DistinguishedName.cs
Initierar en ny instans av X500DistinguishedName klassen med den angivna strängen och X500DistinguishedNameFlags flaggan.
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)
Parametrar
- distinguishedName
- String
En sträng som representerar det unika namnet.
En bitvis kombination av uppräkningsvärdena som anger egenskaperna för det unika namnet.
Exempel
I följande kodexempel visas hur du X500DistinguishedName använder klassen.
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
Kommentarer
Klassen X500DistinguishedName ärver från AsnEncodedData klassen.