X509SelectionFlag Enum
Definitie
Belangrijk
Bepaalde informatie heeft betrekking op een voorlopige productversie die aanzienlijk kan worden gewijzigd voordat deze wordt uitgebracht. Microsoft biedt geen enkele expliciete of impliciete garanties met betrekking tot de informatie die hier wordt verstrekt.
Hiermee geeft u het type selectie op dat is aangevraagd met behulp van de SelectFromCollection methode.
public enum class X509SelectionFlag
public enum X509SelectionFlag
type X509SelectionFlag =
Public Enum X509SelectionFlag
- Overname
Velden
| Name | Waarde | Description |
|---|---|---|
| SingleSelection | 0 | Eén selectie. Met de gebruikersinterface kan de gebruiker één X.509-certificaat selecteren. |
| MultiSelection | 1 | Een meervoudige selectie. De gebruiker kan de SHIFT- of CRTL-sleutels gebruiken om meer dan één X.509-certificaat te selecteren. |
Voorbeelden
In het volgende codevoorbeeld ziet u hoe u de selectievlag gebruikt met de X509Certificate2UI.SelectFromCollection methode. Dit codevoorbeeld maakt deel uit van een groter voorbeeld voor de X509Store klasse. In het grotere voorbeeld wordt het persoonlijke certificaatarchief van de huidige gebruiker geopend, kan de gebruiker een certificaat selecteren en vervolgens certificaat- en certificaatketengegevens naar de console schrijven. De uitvoer is afhankelijk van het certificaat dat de gebruiker selecteert.
//Create new X509 store from local certificate store.
X509Store store = new X509Store("MY", StoreLocation.CurrentUser);
store.Open(OpenFlags.OpenExistingOnly | OpenFlags.ReadWrite);
//Output store information.
Console.WriteLine ("Store Information");
Console.WriteLine ("Number of certificates in the store: {0}", store.Certificates.Count);
Console.WriteLine ("Store location: {0}", store.Location);
Console.WriteLine ("Store name: {0} {1}", store.Name, Environment.NewLine);
//Put certificates from the store into a collection so user can select one.
X509Certificate2Collection fcollection = (X509Certificate2Collection)store.Certificates;
X509Certificate2Collection collection = X509Certificate2UI.SelectFromCollection(fcollection, "Select an X509 Certificate", "Choose a certificate to examine.", X509SelectionFlag.SingleSelection);
X509Certificate2 certificate = collection[0];
X509Certificate2UI.DisplayCertificate(certificate);
'Create new X509 store from local certificate store.
Dim store As New X509Store("MY", StoreLocation.CurrentUser)
store.Open(OpenFlags.OpenExistingOnly Or OpenFlags.ReadWrite)
'Output store information.
Console.WriteLine("Store Information")
Console.WriteLine("Number of certificates in the store: {0}", store.Certificates.Count)
Console.WriteLine("Store location: {0}", store.Location)
Console.WriteLine("Store name: {0} {1}", store.Name, Environment.NewLine)
'Put certificates from the store into a collection so user can select one.
Dim fcollection As X509Certificate2Collection = CType(store.Certificates, X509Certificate2Collection)
Dim collection As X509Certificate2Collection = X509Certificate2UI.SelectFromCollection(fcollection, "Select an X509 Certificate", "Choose a certificate to examine.", X509SelectionFlag.SingleSelection)
Dim certificate As X509Certificate2 = collection(0)
X509Certificate2UI.DisplayCertificate(certificate)
Opmerkingen
Deze vlag vertegenwoordigt een of meerdere certificaatselecties met behulp van de X509Certificate2UI.SelectFromCollection methode.