'  
'   Rebex Sample Code License
' 
'   Copyright 2025, REBEX CR s.r.o.
'   All rights reserved.
'   https://www.rebex.net/
' 
'   Permission to use, copy, modify, and/or distribute this software for any
'   purpose with or without fee is hereby granted.
' 
'   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
'   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
'   OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
'   NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
'   HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
'   WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
'   FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
'   OTHER DEALINGS IN THE SOFTWARE.
' 

Imports System.Drawing
Imports System.Windows.Forms
Imports Rebex.Security.Certificates
Imports System.Security.Cryptography.X509Certificates

Public Class ResolveInvalidCertficiateDialog
    Inherits Form
    Private ReadOnly _certificate As Certificate
    Private _certificateChain As CertificateChain

    Public Sub New(dialogMode As ResolveDialogMode, failureReasons As String, certificateChain As CertificateChain, storedThumbprint As String)
        If certificateChain Is Nothing Then
            Throw New ArgumentNullException("certificateChain")
        End If

        _certificateChain = certificateChain
        _certificate = certificateChain.LeafCertificate


        InitializeComponent()

        lblReasons.Text = failureReasons
        lblIssuer.Text = _certificate.GetIssuer().GetCommonName()
        lblHostname.Text = _certificate.GetCommonName().ToString()
        lblThumbprint.Text = _certificate.Thumbprint

        If dialogMode = ResolveDialogMode.EntryDiffer Then
            lblReasons.ForeColor = Color.Red
            lblStoredThumbprint.Text = storedThumbprint
        Else
            lblStoredThumbprint.Visible = False
            lblStoredThumbprintLabel.Visible = False
        End If
    End Sub

    Public Sub RemoveRbUseWindows()
        Dim controlName As String = "rbUseWindows"
        Dim ctrl As Control = pnlLayout.Controls(controlName)
        If ctrl Is Nothing Then
            Throw New InvalidOperationException(String.Format("Control '{0}' has not been found.", controlName))
        End If
        pnlLayout.Controls.RemoveByKey(controlName)
    End Sub

    Public Function GetChoosenMode() As CertificateVerifyingMode
        If DialogResult <> DialogResult.OK Then
            Throw New InvalidOperationException("Cannot resolve choosen mode when the dialog has not been confirmed by the OK button.")
        End If

        If rbAcceptAny.Checked Then
            Return CertificateVerifyingMode.AcceptAnyCertificate
        End If
        If rbStoreLocaly.Checked Then
            Return CertificateVerifyingMode.LocalyStoredThumbprint
        End If
        If rbUseWindows.Checked Then
            Return CertificateVerifyingMode.UseWindowsInfrastructure
        End If
        If rbReject.Checked Then
            Return CertificateVerifyingMode.RejectCertificate
        End If

        Throw New InvalidOperationException("Unexpected state when resolving CertfificateVerifyingMode.")
    End Function

    Public Sub EnableAddCertificateToCA(show As Boolean)
        btnAddCertToCA.Visible = show
    End Sub

    Private Sub ResolveInvalidCertficiateDialog_Activated(sender As Object, e As EventArgs) Handles MyBase.Activated
        ' recalculate height
        Dim delta As Integer = Me.Height - pnlLayout.Height
        pnlLayout.Size = New Size(pnlLayout.Width, pnlButtons.Top + pnlButtons.Height)
        Me.Size = New Size(Me.Width, pnlLayout.Height + delta)
        Me.MinimumSize = New Size(Me.MinimumSize.Width, Me.Height)

        RecalculateAddCertToCAButtonAvailability()
    End Sub

    Private Sub RecalculateAddCertToCAButtonAvailability()
        btnAddCertToCA.Enabled = rbUseWindows.Checked
    End Sub

    Private Sub rb_CheckedChanged(sender As Object, e As EventArgs) Handles rbAcceptAny.CheckedChanged
        RecalculateAddCertToCAButtonAvailability()
    End Sub

    Private Sub llViewCertificate_LinkClicked(sender As Object, e As LinkLabelLinkClickedEventArgs) Handles llViewCertificate.LinkClicked
        X509Certificate2UI.DisplayCertificate(X509CertificateLoader.LoadCertificate(_certificate.GetRawCertData()))
    End Sub

    Private Sub btnAddCertToCA_Click(sender As Object, e As EventArgs) Handles btnAddCertToCA.Click
        Dim trustedCaStore As New CertificateStore(CertificateStoreName.Root)
        Dim rootCertificate As Certificate = _certificateChain.RootCertificate

        trustedCaStore.Add(rootCertificate)
    End Sub

    ''' <summary>
    ''' Required designer variable.
    ''' </summary>
    Private components As System.ComponentModel.IContainer = Nothing

    ''' <summary>
    ''' Clean up any resources being used.
    ''' </summary>
    ''' <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
    Protected Overrides Sub Dispose(disposing As Boolean)
        If disposing AndAlso (components IsNot Nothing) Then
            components.Dispose()
        End If
        MyBase.Dispose(disposing)
    End Sub

    #Region "Windows Form Designer generated code"

    ''' <summary>
    ''' Required method for Designer support - do not modify
    ''' the contents of this method with the code editor.
    ''' </summary>
    Private Sub InitializeComponent()
        Me.label1 = New System.Windows.Forms.Label()
        Me.pnlLayout = New System.Windows.Forms.Panel()
        Me.pnlButtons = New System.Windows.Forms.Panel()
        Me.btnAddCertToCA = New System.Windows.Forms.Button()
        Me.btnCancel = New System.Windows.Forms.Button()
        Me.btnOk = New System.Windows.Forms.Button()
        Me.rbReject = New System.Windows.Forms.RadioButton()
        Me.rbAcceptAny = New System.Windows.Forms.RadioButton()
        Me.rbStoreLocaly = New System.Windows.Forms.RadioButton()
        Me.rbUseWindows = New System.Windows.Forms.RadioButton()
        Me.label3 = New System.Windows.Forms.Label()
        Me.pnlDetails = New System.Windows.Forms.Panel()
        Me.lblStoredThumbprint = New System.Windows.Forms.Label()
        Me.lblStoredThumbprintLabel = New System.Windows.Forms.Label()
        Me.lblThumbprint = New System.Windows.Forms.Label()
        Me.label5 = New System.Windows.Forms.Label()
        Me.llViewCertificate = New System.Windows.Forms.LinkLabel()
        Me.label12 = New System.Windows.Forms.Label()
        Me.lblHostname = New System.Windows.Forms.Label()
        Me.lblIssuer = New System.Windows.Forms.Label()
        Me.label4 = New System.Windows.Forms.Label()
        Me.label2 = New System.Windows.Forms.Label()
        Me.lblReasons = New System.Windows.Forms.Label()
        Me.pnlLayout.SuspendLayout()
        Me.pnlButtons.SuspendLayout()
        Me.pnlDetails.SuspendLayout()
        Me.SuspendLayout()
        '
        'label1
        '
        Me.label1.AutoSize = True
        Me.label1.Dock = System.Windows.Forms.DockStyle.Top
        Me.label1.Location = New System.Drawing.Point(0, 0)
        Me.label1.Name = "label1"
        Me.label1.Size = New System.Drawing.Size(166, 13)
        Me.label1.TabIndex = 0
        Me.label1.Text = "Server certificate validation result:"
        '
        'pnlLayout
        '
        Me.pnlLayout.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
            Or System.Windows.Forms.AnchorStyles.Left) _
            Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.pnlLayout.Controls.Add(Me.pnlButtons)
        Me.pnlLayout.Controls.Add(Me.rbReject)
        Me.pnlLayout.Controls.Add(Me.rbAcceptAny)
        Me.pnlLayout.Controls.Add(Me.rbStoreLocaly)
        Me.pnlLayout.Controls.Add(Me.rbUseWindows)
        Me.pnlLayout.Controls.Add(Me.label3)
        Me.pnlLayout.Controls.Add(Me.pnlDetails)
        Me.pnlLayout.Controls.Add(Me.label2)
        Me.pnlLayout.Controls.Add(Me.lblReasons)
        Me.pnlLayout.Controls.Add(Me.label1)
        Me.pnlLayout.Location = New System.Drawing.Point(12, 12)
        Me.pnlLayout.Name = "pnlLayout"
        Me.pnlLayout.Size = New System.Drawing.Size(493, 411)
        Me.pnlLayout.TabIndex = 1
        '
        'pnlButtons
        '
        Me.pnlButtons.Controls.Add(Me.btnAddCertToCA)
        Me.pnlButtons.Controls.Add(Me.btnCancel)
        Me.pnlButtons.Controls.Add(Me.btnOk)
        Me.pnlButtons.Dock = System.Windows.Forms.DockStyle.Bottom
        Me.pnlButtons.Location = New System.Drawing.Point(0, 377)
        Me.pnlButtons.Name = "pnlButtons"
        Me.pnlButtons.Size = New System.Drawing.Size(493, 34)
        Me.pnlButtons.TabIndex = 9
        '
        'btnAddCertToCA
        '
        Me.btnAddCertToCA.DialogResult = System.Windows.Forms.DialogResult.OK
        Me.btnAddCertToCA.FlatStyle = System.Windows.Forms.FlatStyle.System
        Me.btnAddCertToCA.Location = New System.Drawing.Point(6, 6)
        Me.btnAddCertToCA.Name = "btnAddCertToCA"
        Me.btnAddCertToCA.Size = New System.Drawing.Size(239, 23)
        Me.btnAddCertToCA.TabIndex = 12
        Me.btnAddCertToCA.Text = "OK && Always &Trust This Authority"
        Me.btnAddCertToCA.UseVisualStyleBackColor = True
        Me.btnAddCertToCA.Visible = False
        '
        'btnCancel
        '
        Me.btnCancel.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel
        Me.btnCancel.FlatStyle = System.Windows.Forms.FlatStyle.System
        Me.btnCancel.Location = New System.Drawing.Point(418, 6)
        Me.btnCancel.Name = "btnCancel"
        Me.btnCancel.Size = New System.Drawing.Size(75, 23)
        Me.btnCancel.TabIndex = 11
        Me.btnCancel.Text = "Cancel"
        Me.btnCancel.UseVisualStyleBackColor = True
        '
        'btnOk
        '
        Me.btnOk.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.btnOk.DialogResult = System.Windows.Forms.DialogResult.OK
        Me.btnOk.FlatStyle = System.Windows.Forms.FlatStyle.System
        Me.btnOk.Location = New System.Drawing.Point(337, 6)
        Me.btnOk.Name = "btnOk"
        Me.btnOk.Size = New System.Drawing.Size(75, 23)
        Me.btnOk.TabIndex = 10
        Me.btnOk.Text = "OK"
        Me.btnOk.UseVisualStyleBackColor = True
        '
        'rbReject
        '
        Me.rbReject.AutoSize = True
        Me.rbReject.Checked = True
        Me.rbReject.Dock = System.Windows.Forms.DockStyle.Top
        Me.rbReject.Location = New System.Drawing.Point(0, 304)
        Me.rbReject.Name = "rbReject"
        Me.rbReject.Padding = New System.Windows.Forms.Padding(10, 0, 10, 0)
        Me.rbReject.Size = New System.Drawing.Size(493, 17)
        Me.rbReject.TabIndex = 8
        Me.rbReject.TabStop = True
        Me.rbReject.Text = "Reject the server certificate"
        Me.rbReject.UseVisualStyleBackColor = True
        '
        'rbAcceptAny
        '
        Me.rbAcceptAny.AutoSize = True
        Me.rbAcceptAny.CheckAlign = System.Drawing.ContentAlignment.TopLeft
        Me.rbAcceptAny.Dock = System.Windows.Forms.DockStyle.Top
        Me.rbAcceptAny.Location = New System.Drawing.Point(0, 287)
        Me.rbAcceptAny.Name = "rbAcceptAny"
        Me.rbAcceptAny.Padding = New System.Windows.Forms.Padding(10, 0, 10, 0)
        Me.rbAcceptAny.Size = New System.Drawing.Size(493, 17)
        Me.rbAcceptAny.TabIndex = 7
        Me.rbAcceptAny.Text = "Ignore the failure and accept the certificate"
        Me.rbAcceptAny.UseVisualStyleBackColor = True
        '
        'rbStoreLocaly
        '
        Me.rbStoreLocaly.AutoSize = True
        Me.rbStoreLocaly.CheckAlign = System.Drawing.ContentAlignment.TopLeft
        Me.rbStoreLocaly.Dock = System.Windows.Forms.DockStyle.Top
        Me.rbStoreLocaly.Location = New System.Drawing.Point(0, 270)
        Me.rbStoreLocaly.Name = "rbStoreLocaly"
        Me.rbStoreLocaly.Padding = New System.Windows.Forms.Padding(10, 0, 10, 0)
        Me.rbStoreLocaly.Size = New System.Drawing.Size(493, 17)
        Me.rbStoreLocaly.TabIndex = 6
        Me.rbStoreLocaly.Text = "Accept the server certificate (and remember it)"
        Me.rbStoreLocaly.TextAlign = System.Drawing.ContentAlignment.TopLeft
        Me.rbStoreLocaly.UseVisualStyleBackColor = True
        '
        'rbUseWindows
        '
        Me.rbUseWindows.AutoSize = True
        Me.rbUseWindows.CheckAlign = System.Drawing.ContentAlignment.TopLeft
        Me.rbUseWindows.Dock = System.Windows.Forms.DockStyle.Top
        Me.rbUseWindows.Location = New System.Drawing.Point(0, 253)
        Me.rbUseWindows.Name = "rbUseWindows"
        Me.rbUseWindows.Padding = New System.Windows.Forms.Padding(10, 0, 10, 0)
        Me.rbUseWindows.Size = New System.Drawing.Size(493, 17)
        Me.rbUseWindows.TabIndex = 5
        Me.rbUseWindows.Text = "Validate the certificate using Windows certificate infrastructure"
        Me.rbUseWindows.UseVisualStyleBackColor = True
        '
        'label3
        '
        Me.label3.AutoSize = True
        Me.label3.Dock = System.Windows.Forms.DockStyle.Top
        Me.label3.Location = New System.Drawing.Point(0, 230)
        Me.label3.Name = "label3"
        Me.label3.Padding = New System.Windows.Forms.Padding(0, 5, 0, 5)
        Me.label3.Size = New System.Drawing.Size(159, 23)
        Me.label3.TabIndex = 4
        Me.label3.Text = "How would you like to proceed?"
        '
        'pnlDetails
        '
        Me.pnlDetails.BackColor = System.Drawing.SystemColors.ControlLightLight
        Me.pnlDetails.Controls.Add(Me.lblStoredThumbprint)
        Me.pnlDetails.Controls.Add(Me.lblStoredThumbprintLabel)
        Me.pnlDetails.Controls.Add(Me.lblThumbprint)
        Me.pnlDetails.Controls.Add(Me.label5)
        Me.pnlDetails.Controls.Add(Me.llViewCertificate)
        Me.pnlDetails.Controls.Add(Me.label12)
        Me.pnlDetails.Controls.Add(Me.lblHostname)
        Me.pnlDetails.Controls.Add(Me.lblIssuer)
        Me.pnlDetails.Controls.Add(Me.label4)
        Me.pnlDetails.Dock = System.Windows.Forms.DockStyle.Top
        Me.pnlDetails.Location = New System.Drawing.Point(0, 96)
        Me.pnlDetails.Name = "pnlDetails"
        Me.pnlDetails.Padding = New System.Windows.Forms.Padding(10)
        Me.pnlDetails.Size = New System.Drawing.Size(493, 134)
        Me.pnlDetails.TabIndex = 3
        '
        'lblStoredThumbprint
        '
        Me.lblStoredThumbprint.Location = New System.Drawing.Point(106, 89)
        Me.lblStoredThumbprint.Name = "lblStoredThumbprint"
        Me.lblStoredThumbprint.Size = New System.Drawing.Size(381, 30)
        Me.lblStoredThumbprint.TabIndex = 15
        Me.lblStoredThumbprint.Text = "00:a0:b0"
        '
        'lblStoredThumbprintLabel
        '
        Me.lblStoredThumbprintLabel.AutoSize = True
        Me.lblStoredThumbprintLabel.Location = New System.Drawing.Point(3, 89)
        Me.lblStoredThumbprintLabel.Name = "lblStoredThumbprintLabel"
        Me.lblStoredThumbprintLabel.Padding = New System.Windows.Forms.Padding(5, 0, 0, 0)
        Me.lblStoredThumbprintLabel.Size = New System.Drawing.Size(98, 13)
        Me.lblStoredThumbprintLabel.TabIndex = 14
        Me.lblStoredThumbprintLabel.Text = "Stored thumbprint:"
        '
        'lblThumbprint
        '
        Me.lblThumbprint.Location = New System.Drawing.Point(106, 56)
        Me.lblThumbprint.Name = "lblThumbprint"
        Me.lblThumbprint.Size = New System.Drawing.Size(381, 30)
        Me.lblThumbprint.TabIndex = 13
        Me.lblThumbprint.Text = "00:a0:b0"
        '
        'label5
        '
        Me.label5.AutoSize = True
        Me.label5.Location = New System.Drawing.Point(3, 56)
        Me.label5.Name = "label5"
        Me.label5.Padding = New System.Windows.Forms.Padding(5, 0, 0, 0)
        Me.label5.Size = New System.Drawing.Size(68, 13)
        Me.label5.TabIndex = 12
        Me.label5.Text = "Thumbprint:"
        '
        'llViewCertificate
        '
        Me.llViewCertificate.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.llViewCertificate.AutoSize = True
        Me.llViewCertificate.Location = New System.Drawing.Point(390, 39)
        Me.llViewCertificate.Name = "llViewCertificate"
        Me.llViewCertificate.Size = New System.Drawing.Size(97, 13)
        Me.llViewCertificate.TabIndex = 11
        Me.llViewCertificate.TabStop = True
        Me.llViewCertificate.Text = "View the certificate"
        Me.llViewCertificate.TextAlign = System.Drawing.ContentAlignment.TopRight
        '
        'label12
        '
        Me.label12.AutoSize = True
        Me.label12.Location = New System.Drawing.Point(3, 39)
        Me.label12.Name = "label12"
        Me.label12.Padding = New System.Windows.Forms.Padding(5, 0, 0, 0)
        Me.label12.Size = New System.Drawing.Size(63, 13)
        Me.label12.TabIndex = 10
        Me.label12.Text = "Hostname:"
        '
        'lblHostname
        '
        Me.lblHostname.Location = New System.Drawing.Point(106, 39)
        Me.lblHostname.Name = "lblHostname"
        Me.lblHostname.Size = New System.Drawing.Size(118, 17)
        Me.lblHostname.TabIndex = 9
        Me.lblHostname.Text = "www.rebex.net"
        '
        'lblIssuer
        '
        Me.lblIssuer.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _
            Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.lblIssuer.Location = New System.Drawing.Point(106, 4)
        Me.lblIssuer.Name = "lblIssuer"
        Me.lblIssuer.Size = New System.Drawing.Size(387, 30)
        Me.lblIssuer.TabIndex = 1
        Me.lblIssuer.Text = "Issuer..." & Global.Microsoft.VisualBasic.ChrW(13) & Global.Microsoft.VisualBasic.ChrW(10) & "...issuer"
        '
        'label4
        '
        Me.label4.AutoSize = True
        Me.label4.Location = New System.Drawing.Point(3, 4)
        Me.label4.Name = "label4"
        Me.label4.Padding = New System.Windows.Forms.Padding(5, 0, 0, 0)
        Me.label4.Size = New System.Drawing.Size(43, 13)
        Me.label4.TabIndex = 0
        Me.label4.Text = "Issuer:"
        '
        'label2
        '
        Me.label2.AutoSize = True
        Me.label2.Dock = System.Windows.Forms.DockStyle.Top
        Me.label2.Location = New System.Drawing.Point(0, 78)
        Me.label2.Name = "label2"
        Me.label2.Padding = New System.Windows.Forms.Padding(0, 0, 0, 5)
        Me.label2.Size = New System.Drawing.Size(90, 18)
        Me.label2.TabIndex = 2
        Me.label2.Text = "Certificate details:"
        '
        'lblReasons
        '
        Me.lblReasons.Dock = System.Windows.Forms.DockStyle.Top
        Me.lblReasons.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point, CType(238, Byte))
        Me.lblReasons.Location = New System.Drawing.Point(0, 13)
        Me.lblReasons.Name = "lblReasons"
        Me.lblReasons.Padding = New System.Windows.Forms.Padding(10)
        Me.lblReasons.Size = New System.Drawing.Size(493, 65)
        Me.lblReasons.TabIndex = 1
        Me.lblReasons.Text = "reasons..."
        '
        'ResolveInvalidCertficiateDialog
        '
        Me.AcceptButton = Me.btnOk
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.CancelButton = Me.btnCancel
        Me.ClientSize = New System.Drawing.Size(517, 441)
        Me.Controls.Add(Me.pnlLayout)
        Me.MaximizeBox = False
        Me.MinimizeBox = False
        Me.MinimumSize = New System.Drawing.Size(530, 39)
        Me.Name = "ResolveInvalidCertficiateDialog"
        Me.ShowIcon = False
        Me.ShowInTaskbar = False
        Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent
        Me.Text = "Untrusted Server Certificate"
        Me.pnlLayout.ResumeLayout(False)
        Me.pnlLayout.PerformLayout()
        Me.pnlButtons.ResumeLayout(False)
        Me.pnlDetails.ResumeLayout(False)
        Me.pnlDetails.PerformLayout()
        Me.ResumeLayout(False)

    End Sub

    #End Region

    Private label1 As System.Windows.Forms.Label
    Private pnlLayout As System.Windows.Forms.Panel
    Private btnOk As System.Windows.Forms.Button
    Private btnCancel As System.Windows.Forms.Button
    Private lblReasons As System.Windows.Forms.Label
    Private label2 As System.Windows.Forms.Label
    Private rbUseWindows As System.Windows.Forms.RadioButton
    Private WithEvents rbAcceptAny As System.Windows.Forms.RadioButton
    Private label3 As System.Windows.Forms.Label
    Private rbStoreLocaly As System.Windows.Forms.RadioButton
    Private rbReject As System.Windows.Forms.RadioButton
    Private WithEvents btnAddCertToCA As System.Windows.Forms.Button
    Private pnlButtons As System.Windows.Forms.Panel
    Private pnlDetails As System.Windows.Forms.Panel
    Private WithEvents llViewCertificate As System.Windows.Forms.LinkLabel
    Private label12 As System.Windows.Forms.Label
    Private lblHostname As System.Windows.Forms.Label
    Private lblIssuer As System.Windows.Forms.Label
    Private label4 As System.Windows.Forms.Label
    Private lblStoredThumbprint As Label
    Private lblStoredThumbprintLabel As Label
    Private lblThumbprint As Label
    Private label5 As Label


End Class
