home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 September / Chip_2002-09_cd1.bin / zkuste / vbasic / Data / Utils / XZipComp.exe / XceedEncryption.Cab / F112965_Option.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  2001-07-04  |  7.2 KB  |  203 lines

  1. VERSION 5.00
  2. Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
  3. Begin VB.Form frmOption 
  4.    BorderStyle     =   3  'Fixed Dialog
  5.    Caption         =   "Options"
  6.    ClientHeight    =   1395
  7.    ClientLeft      =   0
  8.    ClientTop       =   285
  9.    ClientWidth     =   8355
  10.    LinkTopic       =   "Form1"
  11.    MaxButton       =   0   'False
  12.    MinButton       =   0   'False
  13.    ScaleHeight     =   1395
  14.    ScaleWidth      =   8355
  15.    ShowInTaskbar   =   0   'False
  16.    StartUpPosition =   1  'CenterOwner
  17.    Begin VB.CommandButton cmdSelectPublicKeyFile 
  18.       Caption         =   "..."
  19.       Height          =   285
  20.       Left            =   7950
  21.       TabIndex        =   3
  22.       Top             =   525
  23.       Width           =   285
  24.    End
  25.    Begin VB.TextBox txtPublicKeyFile 
  26.       Height          =   285
  27.       Left            =   1500
  28.       OLEDropMode     =   1  'Manual
  29.       TabIndex        =   2
  30.       Top             =   525
  31.       Width           =   6390
  32.    End
  33.    Begin VB.CommandButton cmdSelectPrivateKeyFile 
  34.       Caption         =   "..."
  35.       Height          =   285
  36.       Left            =   7950
  37.       TabIndex        =   1
  38.       Top             =   150
  39.       Width           =   285
  40.    End
  41.    Begin VB.TextBox txtPrivateKeyFile 
  42.       Height          =   285
  43.       Left            =   1500
  44.       OLEDropMode     =   1  'Manual
  45.       TabIndex        =   0
  46.       Top             =   150
  47.       Width           =   6390
  48.    End
  49.    Begin VB.CommandButton cmdRandomKeyPair 
  50.       Caption         =   "Set random key pair"
  51.       Height          =   315
  52.       Left            =   75
  53.       TabIndex        =   4
  54.       Top             =   975
  55.       Width           =   1815
  56.    End
  57.    Begin VB.CommandButton cmdCancel 
  58.       Cancel          =   -1  'True
  59.       Caption         =   "Cancel"
  60.       Height          =   315
  61.       Left            =   7125
  62.       TabIndex        =   6
  63.       Top             =   975
  64.       Width           =   1140
  65.    End
  66.    Begin VB.CommandButton cmdOk 
  67.       Caption         =   "Ok"
  68.       Default         =   -1  'True
  69.       Height          =   315
  70.       Left            =   5925
  71.       TabIndex        =   5
  72.       Top             =   975
  73.       Width           =   1140
  74.    End
  75.    Begin MSComDlg.CommonDialog dlgCommon 
  76.       Left            =   2325
  77.       Top             =   900
  78.       _ExtentX        =   847
  79.       _ExtentY        =   847
  80.       _Version        =   393216
  81.    End
  82.    Begin VB.Label lbl 
  83.       Caption         =   "Public key file"
  84.       Height          =   240
  85.       Index           =   1
  86.       Left            =   150
  87.       TabIndex        =   8
  88.       Top             =   525
  89.       Width           =   1290
  90.    End
  91.    Begin VB.Label lbl 
  92.       Caption         =   "Private key file"
  93.       Height          =   240
  94.       Index           =   0
  95.       Left            =   150
  96.       TabIndex        =   7
  97.       Top             =   150
  98.       Width           =   1290
  99.    End
  100. Attribute VB_Name = "frmOption"
  101. Attribute VB_GlobalNameSpace = False
  102. Attribute VB_Creatable = False
  103. Attribute VB_PredeclaredId = True
  104. Attribute VB_Exposed = False
  105. ' Xceed Encryption Library - Signer sample
  106. ' Copyright (c) 2001 Xceed Software Inc.
  107. ' [Option.frm]
  108. ' This form module displays available Signing options.
  109. ' This file is part of the Xceed Encryption Library sample applications.
  110. ' The source code in this file is only intended as a supplement to Xceed
  111. ' Encryption Library's documentation, and is provided "as is", without
  112. ' warranty of any kind, either expressed or implied.
  113. Option Explicit
  114. Private m_bOk As Boolean
  115. Public Function ShowForm(ByRef sPrivateKeyFile As String, _
  116.                          ByRef sPublicKeyFile As String) As Boolean
  117.     txtPrivateKeyFile.Text = sPrivateKeyFile
  118.     txtPublicKeyFile.Text = sPublicKeyFile
  119.     Call Me.Show(vbModal)
  120.     If m_bOk Then
  121.         'The user clicked OK : return the chosen values
  122.         sPrivateKeyFile = txtPrivateKeyFile.Text
  123.         sPublicKeyFile = txtPublicKeyFile.Text
  124.     End If
  125.     ShowForm = m_bOk
  126.     Call Unload(Me)
  127. End Function
  128. Private Sub cmdCancel_Click()
  129.     If Me.Visible Then
  130.         Call Me.Hide
  131.     End If
  132. End Sub
  133. Private Sub cmdOk_Click()
  134.     m_bOk = True
  135.     Call SaveKeyFileSetting
  136.     Call Me.Hide
  137. End Sub
  138. '------------------------------------------------------------------------------------
  139. 'Generate new private and public keys stored in the file specified in the
  140. 'respective text boxes.
  141. '------------------------------------------------------------------------------------
  142. Private Sub cmdRandomKeyPair_Click()
  143.     Dim fxKeyPair As frmKeyPair
  144.     If Len(Trim$(txtPrivateKeyFile.Text)) = 0 Or Len(Trim$(txtPublicKeyFile.Text)) = 0 Then
  145.         'The file names are mandatory
  146.         Call MsgBox("You must specify the key file names where will be stored the private and public keys", vbExclamation, "Error")
  147.     Else
  148.         'Show the dialog box used to generate a new key pair, passing it the two file names
  149.         Set fxKeyPair = New frmKeyPair
  150.         Call fxKeyPair.ShowForm(txtPrivateKeyFile.Text, txtPublicKeyFile.Text)
  151.         Set fxKeyPair = Nothing
  152.     End If
  153. End Sub
  154. '------------------------------------------------------------------------------------
  155. 'Select the file name that contain (or will contain) the private key.
  156. '------------------------------------------------------------------------------------
  157. Private Sub cmdSelectPrivateKeyFile_Click()
  158.     With dlgCommon
  159.         .FileName = ""
  160.         .DialogTitle = "Source file"
  161.         .Filter = "Key file (*.key)|*.key|All type (*.*)|*.*"
  162.         .FilterIndex = 0
  163.         .Flags = cdlOFNExplorer
  164.         On Error Resume Next
  165.             Call .ShowOpen
  166.             If Len(.FileName) > 0 Then
  167.                 txtPrivateKeyFile.Text = .FileName
  168.             End If
  169.         On Error GoTo 0
  170.     End With
  171. End Sub
  172. '------------------------------------------------------------------------------------
  173. 'Select the file name that contain (or will contain) the public key.
  174. '------------------------------------------------------------------------------------
  175. Private Sub cmdSelectPublicKeyFile_Click()
  176.     With dlgCommon
  177.         .FileName = ""
  178.         .DialogTitle = "Source file"
  179.         .Filter = "Key file (*.key)|*.key|All type (*.*)|*.*"
  180.         .FilterIndex = 0
  181.         .Flags = cdlOFNExplorer
  182.         On Error Resume Next
  183.             Call .ShowOpen
  184.             If Len(.FileName) > 0 Then
  185.                 txtPublicKeyFile.Text = .FileName
  186.             End If
  187.         On Error GoTo 0
  188.     End With
  189. End Sub
  190. Private Sub Form_Load()
  191.     m_bOk = False
  192. End Sub
  193. Private Sub Form_Unload(Cancel As Integer)
  194.     Call cmdCancel_Click
  195. End Sub
  196. '------------------------------------------------------------------------------------
  197. 'Save the current private key file name
  198. '------------------------------------------------------------------------------------
  199. Private Sub SaveKeyFileSetting()
  200.     Call SaveSetting("XceedSigner", "Signing", "PrivateKeyFile", txtPrivateKeyFile.Text)
  201.     Call SaveSetting("XceedSigner", "Signing", "PublicKeyFile", txtPublicKeyFile.Text)
  202. End Sub
  203.