home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
- Begin VB.Form frmOption
- BorderStyle = 3 'Fixed Dialog
- Caption = "Options"
- ClientHeight = 1395
- ClientLeft = 0
- ClientTop = 285
- ClientWidth = 8355
- LinkTopic = "Form1"
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 1395
- ScaleWidth = 8355
- ShowInTaskbar = 0 'False
- StartUpPosition = 1 'CenterOwner
- Begin VB.CommandButton cmdSelectPublicKeyFile
- Caption = "..."
- Height = 285
- Left = 7950
- TabIndex = 3
- Top = 525
- Width = 285
- End
- Begin VB.TextBox txtPublicKeyFile
- Height = 285
- Left = 1500
- OLEDropMode = 1 'Manual
- TabIndex = 2
- Top = 525
- Width = 6390
- End
- Begin VB.CommandButton cmdSelectPrivateKeyFile
- Caption = "..."
- Height = 285
- Left = 7950
- TabIndex = 1
- Top = 150
- Width = 285
- End
- Begin VB.TextBox txtPrivateKeyFile
- Height = 285
- Left = 1500
- OLEDropMode = 1 'Manual
- TabIndex = 0
- Top = 150
- Width = 6390
- End
- Begin VB.CommandButton cmdRandomKeyPair
- Caption = "Set random key pair"
- Height = 315
- Left = 75
- TabIndex = 4
- Top = 975
- Width = 1815
- End
- Begin VB.CommandButton cmdCancel
- Cancel = -1 'True
- Caption = "Cancel"
- Height = 315
- Left = 7125
- TabIndex = 6
- Top = 975
- Width = 1140
- End
- Begin VB.CommandButton cmdOk
- Caption = "Ok"
- Default = -1 'True
- Height = 315
- Left = 5925
- TabIndex = 5
- Top = 975
- Width = 1140
- End
- Begin MSComDlg.CommonDialog dlgCommon
- Left = 2325
- Top = 900
- _ExtentX = 847
- _ExtentY = 847
- _Version = 393216
- End
- Begin VB.Label lbl
- Caption = "Public key file"
- Height = 240
- Index = 1
- Left = 150
- TabIndex = 8
- Top = 525
- Width = 1290
- End
- Begin VB.Label lbl
- Caption = "Private key file"
- Height = 240
- Index = 0
- Left = 150
- TabIndex = 7
- Top = 150
- Width = 1290
- End
- Attribute VB_Name = "frmOption"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- ' Xceed Encryption Library - Signer sample
- ' Copyright (c) 2001 Xceed Software Inc.
- ' [Option.frm]
- ' This form module displays available Signing options.
- ' This file is part of the Xceed Encryption Library sample applications.
- ' The source code in this file is only intended as a supplement to Xceed
- ' Encryption Library's documentation, and is provided "as is", without
- ' warranty of any kind, either expressed or implied.
- Option Explicit
- Private m_bOk As Boolean
- Public Function ShowForm(ByRef sPrivateKeyFile As String, _
- ByRef sPublicKeyFile As String) As Boolean
- txtPrivateKeyFile.Text = sPrivateKeyFile
- txtPublicKeyFile.Text = sPublicKeyFile
- Call Me.Show(vbModal)
- If m_bOk Then
- 'The user clicked OK : return the chosen values
- sPrivateKeyFile = txtPrivateKeyFile.Text
- sPublicKeyFile = txtPublicKeyFile.Text
- End If
- ShowForm = m_bOk
- Call Unload(Me)
- End Function
- Private Sub cmdCancel_Click()
- If Me.Visible Then
- Call Me.Hide
- End If
- End Sub
- Private Sub cmdOk_Click()
- m_bOk = True
- Call SaveKeyFileSetting
- Call Me.Hide
- End Sub
- '------------------------------------------------------------------------------------
- 'Generate new private and public keys stored in the file specified in the
- 'respective text boxes.
- '------------------------------------------------------------------------------------
- Private Sub cmdRandomKeyPair_Click()
- Dim fxKeyPair As frmKeyPair
- If Len(Trim$(txtPrivateKeyFile.Text)) = 0 Or Len(Trim$(txtPublicKeyFile.Text)) = 0 Then
- 'The file names are mandatory
- Call MsgBox("You must specify the key file names where will be stored the private and public keys", vbExclamation, "Error")
- Else
- 'Show the dialog box used to generate a new key pair, passing it the two file names
- Set fxKeyPair = New frmKeyPair
- Call fxKeyPair.ShowForm(txtPrivateKeyFile.Text, txtPublicKeyFile.Text)
- Set fxKeyPair = Nothing
- End If
- End Sub
- '------------------------------------------------------------------------------------
- 'Select the file name that contain (or will contain) the private key.
- '------------------------------------------------------------------------------------
- Private Sub cmdSelectPrivateKeyFile_Click()
- With dlgCommon
- .FileName = ""
- .DialogTitle = "Source file"
- .Filter = "Key file (*.key)|*.key|All type (*.*)|*.*"
- .FilterIndex = 0
- .Flags = cdlOFNExplorer
- On Error Resume Next
- Call .ShowOpen
- If Len(.FileName) > 0 Then
- txtPrivateKeyFile.Text = .FileName
- End If
- On Error GoTo 0
- End With
- End Sub
- '------------------------------------------------------------------------------------
- 'Select the file name that contain (or will contain) the public key.
- '------------------------------------------------------------------------------------
- Private Sub cmdSelectPublicKeyFile_Click()
- With dlgCommon
- .FileName = ""
- .DialogTitle = "Source file"
- .Filter = "Key file (*.key)|*.key|All type (*.*)|*.*"
- .FilterIndex = 0
- .Flags = cdlOFNExplorer
- On Error Resume Next
- Call .ShowOpen
- If Len(.FileName) > 0 Then
- txtPublicKeyFile.Text = .FileName
- End If
- On Error GoTo 0
- End With
- End Sub
- Private Sub Form_Load()
- m_bOk = False
- End Sub
- Private Sub Form_Unload(Cancel As Integer)
- Call cmdCancel_Click
- End Sub
- '------------------------------------------------------------------------------------
- 'Save the current private key file name
- '------------------------------------------------------------------------------------
- Private Sub SaveKeyFileSetting()
- Call SaveSetting("XceedSigner", "Signing", "PrivateKeyFile", txtPrivateKeyFile.Text)
- Call SaveSetting("XceedSigner", "Signing", "PublicKeyFile", txtPublicKeyFile.Text)
- End Sub
-