Click here to Skip to main content
Click here to Skip to main content
 
Add your own
alternative version

Tagged as

X.509 Certificates in .NET

, 16 Dec 2004 CPOL
The article show detail about X509 certificate and its formats with how you can implemnt in .NET
x509_certificates.zip
X509 Certificates
bin
Adnan.cer
Adnanspc.spc
X509 Certificates.exe
X509 Certificates.pdb
obj
Debug
temp
TempPE
X509 Certificates.exe
X509 Certificates.pdb
X509_Certificates.Form1.resources
X509 Certificates.suo
X509 Certificates.vbproj.user
CAPICOM 2.1.0.1
capicom.dll
Imports System.Security.Cryptography.X509Certificates
Imports System.IO
Imports System.Text
Public Class Form1
    Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
    Friend WithEvents Button1 As System.Windows.Forms.Button
    Friend WithEvents LinkLabel1 As System.Windows.Forms.LinkLabel
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.Button1 = New System.Windows.Forms.Button
        Me.LinkLabel1 = New System.Windows.Forms.LinkLabel
        Me.SuspendLayout()
        '
        'Button1
        '
        Me.Button1.Location = New System.Drawing.Point(48, 64)
        Me.Button1.Name = "Button1"
        Me.Button1.Size = New System.Drawing.Size(136, 40)
        Me.Button1.TabIndex = 0
        Me.Button1.Text = "&X.509  Properties"
        '
        'LinkLabel1
        '
        Me.LinkLabel1.Location = New System.Drawing.Point(40, 8)
        Me.LinkLabel1.Name = "LinkLabel1"
        Me.LinkLabel1.Size = New System.Drawing.Size(168, 24)
        Me.LinkLabel1.TabIndex = 1
        Me.LinkLabel1.TabStop = True
        Me.LinkLabel1.Text = "adahmed911@hotmail.com"
        '
        'Form1
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.ClientSize = New System.Drawing.Size(256, 142)
        Me.Controls.Add(Me.LinkLabel1)
        Me.Controls.Add(Me.Button1)
        Me.Name = "Form1"
        Me.Text = "X509 Demo"
        Me.ResumeLayout(False)

    End Sub

#End Region
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        'define certificate to access
        Dim Cert As X509Certificate = X509Certificate.CreateFromCertFile(Directory.GetCurrentDirectory & "\Adnan.cer")
        'Now reterive its properties in output window
        ' Get the value.
        Dim resultsTrue As String = Cert.ToString(True)
        ' Display the value 
        Debug.WriteLine(resultsTrue)
        Dim SerialNumber() As Byte = Cert.GetSerialNumber()
        Dim Sr As Byte
        Debug.Write("Serial Number in Bytes: ")
        For Each Sr In SerialNumber
            Debug.Write(Sr)
        Next
    End Sub
End Class

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Adnan Samuel
Software Developer (Senior)
Pakistan Pakistan
I am software engineer and working from last four years in the information technology field. I love to do intresting tasks. I love to see diffrent places and listening muzik.

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.141216.1 | Last Updated 16 Dec 2004
Article Copyright 2004 by Adnan Samuel
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid