X509SelectionFlag X509SelectionFlag X509SelectionFlag X509SelectionFlag Enum

Definizione

Specifica il tipo di selezione richiesto tramite il metodo SelectFromCollection.Specifies the type of selection requested using the SelectFromCollection method.

public enum class X509SelectionFlag
public enum X509SelectionFlag
type X509SelectionFlag = 
Public Enum X509SelectionFlag
Ereditarietà
X509SelectionFlagX509SelectionFlagX509SelectionFlagX509SelectionFlag

Campi

MultiSelection MultiSelection MultiSelection MultiSelection 1

Selezione multipla.A multiple selection. È possibile utilizzare MAIUSC o CRTL per selezionare più certificati X.509.The user can use the SHIFT or CRTL keys to select more than one X.509 certificate.

SingleSelection SingleSelection SingleSelection SingleSelection 0

Selezione singola.A single selection. L'interfaccia utente consente di selezionare un solo certificato X.509.The UI allows the user to select one X.509 certificate.

Esempi

Nell'esempio di codice riportato di seguito viene illustrato come utilizzare il flag X509Certificate2UI.SelectFromCollection di selezione con il metodo.The following code example demonstrates how to use the selection flag with the X509Certificate2UI.SelectFromCollection method. Questo esempio di codice fa parte di un esempio più ampio fornito X509Store per la classe.This code example is part of a larger example provided for the X509Store class. L'esempio più grande apre l'archivio certificati personale dell'utente corrente, consente all'utente di selezionare un certificato, quindi scrive le informazioni sulla catena di certificati e certificati nella console.The larger example opens the current user's personal certificate store, allows the user to select a certificate, then writes certificate and certificate chain information to the console. L'output dipende dal certificato selezionato dall'utente.The output depends on the certificate the user selects.

//Create new X509 store from local certificate store.
X509Store ^ store = gcnew X509Store( "MY",StoreLocation::CurrentUser );
store->Open( static_cast<OpenFlags>(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 = dynamic_cast<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.
    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)

Commenti

Questo flag rappresenta una selezione di certificato singola o multipla utilizzando X509Certificate2UI.SelectFromCollection il metodo.This flag represents either a single or multiple certificate selection using the X509Certificate2UI.SelectFromCollection method.

Si applica a