⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 32dll.frm

📁 vb下调用usb 接口smartcard的应用例程
💻 FRM
📖 第 1 页 / 共 2 页
字号:
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "eKey MwUsbD.DLL"
   ClientHeight    =   5670
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   8070
   LinkTopic       =   "Form6"
   ScaleHeight     =   5670
   ScaleWidth      =   8070
   StartUpPosition =   3  'Windows Default
   Begin VB.CommandButton WR_Binary 
      Caption         =   "W/R Binary"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   9.75
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   6240
      TabIndex        =   7
      Top             =   3360
      Width           =   1455
   End
   Begin VB.CommandButton Command1 
      Caption         =   "Exit"
      BeginProperty Font 
         Name            =   "Times New Roman"
         Size            =   14.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   615
      Left            =   6240
      TabIndex        =   6
      Top             =   3840
      Width           =   1455
   End
   Begin VB.CommandButton SignVer 
      Caption         =   "Sign/Encrypt"
      BeginProperty Font 
         Name            =   "MS Serif"
         Size            =   9.75
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   6240
      TabIndex        =   5
      Top             =   2880
      Width           =   1455
   End
   Begin VB.CommandButton GenerateRSA 
      Caption         =   "Generate RSA"
      BeginProperty Font 
         Name            =   "MS Serif"
         Size            =   9.75
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   6240
      TabIndex        =   4
      Top             =   2400
      Width           =   1455
   End
   Begin VB.CommandButton CreateRSA 
      Caption         =   "Create File"
      BeginProperty Font 
         Name            =   "MS Serif"
         Size            =   9.75
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   6240
      TabIndex        =   3
      Top             =   1920
      Width           =   1455
   End
   Begin VB.CommandButton Reset 
      Caption         =   "Reset"
      BeginProperty Font 
         Name            =   "MS Serif"
         Size            =   9.75
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   6240
      TabIndex        =   2
      Top             =   1440
      Width           =   1455
   End
   Begin VB.ListBox List1 
      Height          =   3765
      Left            =   720
      TabIndex        =   0
      Top             =   960
      Width           =   5055
   End
   Begin VB.Label Label1 
      Caption         =   "   32Bit DLL Example"
      BeginProperty Font 
         Name            =   "MS Serif"
         Size            =   18
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00FF0000&
      Height          =   495
      Left            =   1680
      TabIndex        =   1
      Top             =   240
      Width           =   3495
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim AtrByte(50) As Byte
Dim AtrLen As Long
Dim IcRead(300) As Byte
Dim IcWrite(300) As Byte
Dim Wlen, Rlen As Long
Dim Sw1Sw2 As String * 4

Dim strIns As String * 400
Dim str As String * 400
Dim str16 As String * 16
Dim i As Integer

Dim DevState As String * 8
Dim USBport As Long
Dim shareMode As Long

Private Sub Command1_Click()
Unload Me

End Sub

Private Sub CreateRSA_Click()
    List1.Clear
    List1.Refresh
'Reset
    AtrLen = 50
    st = mw_reset(icdev, AtrByte(0), AtrLen)
    If (st <> 0) Then
        List1.AddItem ("Reset Err:" & CStr(st))
    Else
        st = hex_asc(AtrByte(0), str, AtrLen)
        List1.AddItem ("Reset:" & str)
    End If
   
'Del MF
    Rlen = 10
    strIns = "800e000008" & TransferKEY
    Wlen = Len(Trim(strIns)) / 2
    st = asc_hex(strIns, IcWrite(0), Wlen)
    st = mw_protocol(icdev, Wlen, IcWrite(0), Rlen, IcRead(0))
    If (st <> 0) Then
        List1.AddItem ("Del MF ERR:" & CStr(st))
'        Exit Sub
    End If
    st = hex_asc(IcRead(Rlen - 2), Sw1Sw2, 4)
    List1.AddItem ("Del MF :" & Sw1Sw2)


'Create MF
    Rlen = 10
    strIns = "80e0000018" & TransferKEY & "0f01315041592e5359532e4444463031"
    Wlen = Len(Trim(strIns)) / 2
    st = asc_hex(strIns, IcWrite(0), Wlen)
    st = mw_protocol(icdev, Wlen, IcWrite(0), Rlen, IcRead(0))
    If (st <> 0) Then
        List1.AddItem ("Create MF Err st=" & CStr(st))
        Exit Sub
    End If
    st = hex_asc(IcRead(Rlen - 2), Sw1Sw2, 4)
    List1.AddItem ("Create MF : " & Sw1Sw2)

'Create DF ID=2f01
    Rlen = 10
    strIns = "80e00100092f010f001122334455"
    Wlen = Len(Trim(strIns)) / 2
    st = asc_hex(strIns, IcWrite(0), Wlen)
    st = mw_protocol(icdev, Wlen, IcWrite(0), Rlen, IcRead(0))
    If (st <> 0) Then
        List1.AddItem ("Create DF ERR:" & CStr(st))
        Exit Sub
    End If
    st = hex_asc(IcRead(Rlen - 2), Sw1Sw2, 4)
    List1.AddItem ("Create DF : " & Sw1Sw2)

 'Create Public File ID=0001
    Rlen = 10
    strIns = "80e002000700010a0f0f0092"
    Wlen = Len(Trim(strIns)) / 2
    st = asc_hex(strIns, IcWrite(0), Wlen)
    st = mw_protocol(icdev, Wlen, IcWrite(0), Rlen, IcRead(0))
    If (st <> 0) Then
        List1.AddItem ("Create Public File ERR:" & CStr(st))
        Exit Sub
    End If
    st = hex_asc(IcRead(Rlen - 2), Sw1Sw2, 4)
    List1.AddItem ("Create Public File  : " & Sw1Sw2)


'Create Secret File ID=0002
    Rlen = 10
    strIns = "80e002000700020b0f0f0157"
    Wlen = Len(Trim(strIns)) / 2
    st = asc_hex(strIns, IcWrite(0), Wlen)
    st = mw_protocol(icdev, Wlen, IcWrite(0), Rlen, IcRead(0))
    If (st <> 0) Then
        List1.AddItem ("Create Secret File ERR:" & CStr(st))
        Exit Sub
    End If
        st = hex_asc(IcRead(Rlen - 2), Sw1Sw2, 4)
        List1.AddItem ("Create Secret File :  " & Sw1Sw2)


'Create Binary File ID=0003
    Rlen = 10
    strIns = "80e00200070003000f0f0180"
    Wlen = Len(Trim(strIns)) / 2
    st = asc_hex(strIns, IcWrite(0), Wlen)

    st = mw_protocol(icdev, Wlen, IcWrite(0), Rlen, IcRead(0))
    If (st <> 0) Then
        List1.AddItem ("Create Binary Err" & CStr(st))
    End If
        st = hex_asc(IcRead(Rlen - 2), Sw1Sw2, 4)
        List1.AddItem ("Create Binary  :  " & Sw1Sw2)

'Create DF End
    Rlen = 10
    strIns = "80e00101022f01"
    Wlen = Len(Trim(strIns)) / 2
    st = asc_hex(strIns, IcWrite(0), Wlen)
    st = mw_protocol(icdev, Wlen, IcWrite(0), Rlen, IcRead(0))
    If (st <> 0) Then
        List1.AddItem ("Create DF End ERR:" & CStr(st))
        Exit Sub
    End If
        st = hex_asc(IcRead(Rlen - 2), Sw1Sw2, 4)
        List1.AddItem ("Create DF End : " & Sw1Sw2)

'Create MF End
    Rlen = 10
    strIns = "80e00001023f00"
    Wlen = Len(Trim(strIns)) / 2
    st = asc_hex(strIns, IcWrite(0), Wlen)
    st = mw_protocol(icdev, Wlen, IcWrite(0), Rlen, IcRead(0))
    If (st <> 0) Then
        List1.AddItem ("Create MF End Err" & CStr(st))
        Exit Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -