Use the X500DistinguishedName class. : X500DistinguishedName « Security « VB.Net Tutorial

Home
VB.Net Tutorial
1.Language Basics
2.Data Type
3.Operator
4.Statements
5.Date Time
6.Class Module
7.Development
8.Collections
9.Generics
10.Attributes
11.Event
12.LINQ
13.Stream File
14.GUI
15.GUI Applications
16.Windows Presentation Foundation
17.2D Graphics
18.I18N Internationlization
19.Reflection
20.Regular Expressions
21.Security
22.Socket Network
23.Thread
24.Windows
25.XML
26.Database ADO.net
27.Design Patterns
VB.Net
VB.Net by API
VB.Net Tutorial » Security » X500DistinguishedName 
21.9.1.Use the X500DistinguishedName class.
Imports System
Imports System.Security.Cryptography
Imports System.Security.Permissions
Imports System.IO
Imports System.Security.Cryptography.X509Certificates

Class MainClass
   Shared Sub Main()
     Dim store As New X509Store("MY", StoreLocation.CurrentUser)
     store.Open((OpenFlags.ReadOnly Or OpenFlags.OpenExistingOnly))
     Dim collection As X509Certificate2Collection = CType(store.Certificates, X509Certificate2Collection)
     Dim fcollection As X509Certificate2Collection = CType(collection.Find(X509FindType.FindByTimeValid, DateTime.Now, False), X509Certificate2Collection)
     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)
     
     Console.WriteLine"Number of certificates: " & scollection.Count)
     
     Dim x509 As X509Certificate2
     For Each x509 In  scollection
        Dim dname As New X500DistinguishedName(x509.SubjectName)
        Console.WriteLine("X500DistinguishedName: " & dname.Name)
         x509.Reset()
     Next x509
     store.Close()
   End Sub
End Class
21.9.X500DistinguishedName
21.9.1.Use the X500DistinguishedName class.
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.