📄 root.frm
字号:
VERSION 5.00
Object = "{10336011-AB2C-11D4-8E1C-00002100DD42}#4.0#0"; "MWAX.ocx"
Begin VB.Form root
Caption = "root"
ClientHeight = 6000
ClientLeft = 60
ClientTop = 345
ClientWidth = 6960
LinkTopic = "Form1"
ScaleHeight = 6000
ScaleWidth = 6960
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command6
Caption = "auth"
Height = 495
Left = 4440
TabIndex = 5
Top = 3600
Width = 1215
End
Begin VB.CommandButton Command5
Caption = "User"
Height = 495
Left = 2280
TabIndex = 4
Top = 4440
Width = 1215
End
Begin VB.CommandButton Command4
Caption = "Psam"
Height = 495
Left = 4440
TabIndex = 3
Top = 2520
Width = 1215
End
Begin VB.CommandButton Command3
Caption = "Master"
Height = 495
Left = 2280
TabIndex = 2
Top = 3480
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "Factory"
Height = 495
Left = 2280
TabIndex = 0
Top = 1560
Width = 1215
End
Begin VB.CommandButton Command2
Caption = "Root"
Height = 495
Left = 2280
TabIndex = 1
Top = 2520
Width = 1215
End
Begin MWAX.MWactiveX MW
Left = 0
Top = 0
_ExtentX = 2990
_ExtentY = 1508
End
End
Attribute VB_Name = "root"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
mbRet = MW.Reset
If Not mbRet Then MsgBox MW.Errshow
mbRet = MW.Delete
If Not mbRet Then MsgBox MW.Errshow
'建MF
mbRet = MW.Create_File(geU_CreateMF, "FFFFFFFFFFFFFFFF0f011234567890")
If Not mbRet Then MsgBox MW.Errshow
'建EF
mbRet = MW.Create_File(geU_CreateEF, "000105f0110219")
If Not mbRet Then MsgBox MW.Errshow
mbRet = MW.Write_Key(geU_WordInstall, "", "", "0101000B0f0111331234")
If Not mbRet Then MsgBox MW.Errshow
mbRet = MW.Create_File(geU_CreateEF, "00020011f0000a")
If Not mbRet Then MsgBox MW.Errshow
Dim pbIn(10) As Byte
mbRet = MW.Asc_To_Hex("8638FFFFFFFFFFFFFFFF", pbIn(0), 10)
If Not mbRet Then MsgBox MW.Errshow
mbRet = MW.Update_Binary(geU_Data, "82", 0, 10, pbIn())
If Not mbRet Then MsgBox MW.Errshow
'建结束MF
mbRet = MW.Create_File(geU_CreateEndMF, "")
If Not mbRet Then MsgBox MW.Errshow
End Sub
Private Sub Command2_Click()
Dim pbOut(8) As Byte
Dim pbIn(10) As Byte
Dim psTransCode As String
'第一步:读传输代码.
MsgBox "请在下卡座插入生厂商认证卡", vbInformation, "提示信息"
mbRet = MW.Sam_Reset
If Not mbRet Then MsgBox MW.Errshow: Exit Sub
MsgBox "取得生厂商密钥"
mbRet = MW.Sam_Verify("1234")
If Not mbRet Then MsgBox MW.Errshow: Exit Sub
mbRet = MW.Sam_Read_Binary("82", 2, 8, pbOut())
If Not mbRet Then MsgBox MW.Errshow: Exit Sub
mbRet = MW.Hex_To_Asc(pbOut(0), psTransCode, 8)
If Not mbRet Then MsgBox MW.Errshow: Exit Sub
'第二步:建根密钥卡.
MsgBox "取得密钥因子A(8个字符,占8个字节)", vbInformation, "提示信息"
MsgBox "取得密钥因子B(8个字符,占8个字节)", vbInformation, "提示信息"
MsgBox "请在上卡座插入要发行的根密钥卡", vbInformation, "提示信息"
mbRet = MW.Reset
If Not mbRet Then MsgBox MW.Errshow: Exit Sub
mbRet = MW.Delete
If Not mbRet Then MsgBox MW.Errshow
mbRet = MW.Create_File_Psam(geU_CreateMF, "FFFFFFFFFFFFFFFF0f011234567890")
If Not mbRet Then MsgBox MW.Errshow: Exit Sub
'建ATR文件
mbRet = MW.Create_File_Psam(geU_CreateEF, "0001040ff0000a")
If Not mbRet Then MsgBox MW.Errshow: Exit Sub
mbRet = MW.Asc_To_Hex("01000000000000000010", pbIn(0), 10)
If Not mbRet Then MsgBox MW.Errshow: Exit Sub
'写ATR文件
mbRet = MW.Update_Binary_Psam(geU_Data, "81", 0, 10, pbIn())
If Not mbRet Then MsgBox MW.Errshow: Exit Sub
'建KEY文件
mbRet = MW.Create_File_Psam(geU_CreateEF, "00020511001019")
If Not mbRet Then MsgBox MW.Errshow: Exit Sub
'安装KEY
mbRet = MW.Write_Key_Psam(geU_WordInstall, "", psTransCode, "0100000001113312345678901234567890123456789012")
If Not mbRet Then MsgBox MW.Errshow: Exit Sub
mbRet = MW.Write_Key_Psam(geU_WordInstall, "", "12345678901234567890123456789012", "0200000001113312345678901234567890123456789012")
If Not mbRet Then MsgBox MW.Errshow: Exit Sub
mbRet = MW.Write_Key_Psam(geU_WordInstall, "", "12345678901234567890123456789012", "01008D1100110012345678901234567890123456789012")
If Not mbRet Then MsgBox MW.Errshow: Exit Sub
mbRet = MW.Write_Key_Psam(geU_WordInstall, "", "12345678901234567890123456789012", "01000E110011FF12345678901234567890123456789012")
If Not mbRet Then MsgBox MW.Errshow: Exit Sub
mbRet = MW.Write_Key_Psam(geU_WordInstall, "", "12345678901234567890123456789012", "010001110011FF12345678901234567890123456789012")
If Not mbRet Then MsgBox MW.Errshow: Exit Sub
'建文件1
mbRet = MW.Create_File_Psam(geU_CreateEF, "00030011110020")
If Not mbRet Then MsgBox MW.Errshow: Exit Sub
'写文件1
Dim pbCardInfo(32) As Byte
mbRet = MW.Asc_To_Hex("01" + Format(Now, "yyyymmdd") + "1234567890", pbCardInfo(0), 10)
If Not mbRet Then MsgBox MW.Errshow: Exit Sub
mbRet = MW.Update_Binary_Psam(geU_Data, "83", 0, 10, pbCardInfo())
If Not mbRet Then MsgBox MW.Errshow: Exit Sub
mbRet = MW.Create_File_Psam(geU_CreateEndMF, "")
If Not mbRet Then MsgBox MW.Errshow: Exit Sub
'第三步:建根密钥认证卡.
MsgBox "根密钥卡已生成,请在上卡座插入要发行的根密钥认证卡", vbInformation, "提示信息"
MsgBox "", vbInformation, ""
MsgBox "", vbInformation, ""
mbRet = MW.Reset
If Not mbRet Then MsgBox MW.Errshow: Exit Sub
mbRet = MW.Delete
If Not mbRet Then MsgBox MW.Errshow
mbRet = MW.Create_File_Psam(geU_CreateMF, "FFFFFFFFFFFFFFFF0f011234567890")
If Not mbRet Then MsgBox MW.Errshow: Exit Sub
'建ATR文件
mbRet = MW.Create_File_Psam(geU_CreateEF, "0001040ff0000a")
If Not mbRet Then MsgBox MW.Errshow: Exit Sub
mbRet = MW.Asc_To_Hex("02000000000000000011", pbIn(0), 10)
If Not mbRet Then MsgBox MW.Errshow: Exit Sub
'写ATR文件
mbRet = MW.Update_Binary_Psam(geU_Data, "81", 0, 10, pbIn())
If Not mbRet Then MsgBox MW.Errshow: Exit Sub
'建KEY文件
mbRet = MW.Create_File_Psam(geU_CreateEF, "00020511001019")
If Not mbRet Then MsgBox MW.Errshow: Exit Sub
'安装KEY
mbRet = MW.Write_Key_Psam(geU_WordInstall, "", psTransCode, "0100000001113312345678901234567890123456789012")
If Not mbRet Then MsgBox MW.Errshow: Exit Sub
mbRet = MW.Write_Key_Psam(geU_WordInstall, "", "12345678901234567890123456789012", "010009110011ff12345678901234567890123456789012")
If Not mbRet Then MsgBox MW.Errshow: Exit Sub
mbRet = MW.Write_Key_Psam(geU_WordInstall, "", "12345678901234567890123456789012", "010008110011ff12345678901234567890123456789012")
If Not mbRet Then MsgBox MW.Errshow: Exit Sub
mbRet = MW.Write_Key_Psam(geU_WordInstall, "", "12345678901234567890123456789012", "01000b000111331234")
If Not mbRet Then MsgBox MW.Errshow: Exit Sub
mbRet = MW.Write_Key_Psam(geU_WordInstall, "", "12345678901234567890123456789012", "01000a000111331234")
If Not mbRet Then MsgBox MW.Errshow: Exit Sub
mbRet = MW.Create_File_Psam(geU_CreateEndMF, "")
If Not mbRet Then MsgBox MW.Errshow: Exit Sub
MsgBox "根密钥认证卡生成成功.", vbInformation, "提示信息"
End Sub
Private Sub Command3_Click()
Dim pbOut(8) As Byte
Dim pbIn(10) As Byte
Dim psTransCode As String
Dim pbRandom(8) As Byte
'第一步:读传输代码.
MsgBox "请在下卡座插入生厂商认证卡", vbInformation, "提示信息"
mbRet = MW.Sam_Reset
If Not mbRet Then MsgBox MW.Errshow: Exit Sub
mbRet = MW.Sam_Verify("1234")
If Not mbRet Then MsgBox MW.Errshow: Exit Sub
mbRet = MW.Sam_Read_Binary("82", 2, 8, pbOut())
If Not mbRet Then MsgBox MW.Errshow: Exit Sub
mbRet = MW.Hex_To_Asc(pbOut(0), psTransCode, 8)
If Not mbRet Then MsgBox MW.Errshow: Exit Sub
'第二步:相互认证
MsgBox "请在上卡座插入根密钥认证卡,下卡座插入根密钥卡.", vbInformation, "提示信息"
mbRet = MW.Reset
If Not mbRet Then MsgBox MW.Errshow: Exit Sub
mbRet = MW.Sam_Reset
If Not mbRet Then MsgBox MW.Errshow: Exit Sub
mbRet = MW.Sam_Get_Challenge_Psam(geU_Random8, pbRandom())
If Not mbRet Then MsgBox MW.Errshow: Exit Sub
MsgBox "取得PIN", vbInformation, "提示信息"
mbRet = MW.Verify_Psam("1234")
If Not mbRet Then MsgBox MW.Errshow: Exit Sub
mbRet = MW.Internal_Authentication_Psam("01", pbRandom(), pbOut())
If Not mbRet Then MsgBox MW.Errshow: Exit Sub
mbRet = MW.Sam_External_Authentication_Psam("02", pbOut())
If Not mbRet Then MsgBox MW.Errshow: Exit Sub
'第三步:取得机构代码
MsgBox "取得机构代码", vbInformation, ""
'第四步:建根密钥卡.
MsgBox "请在上卡座插入要发行的主密钥卡", vbInformation, "提示信息"
mbRet = MW.Reset
If Not mbRet Then MsgBox MW.Errshow: Exit Sub
mbRet = MW.Delete
If Not mbRet Then MsgBox MW.Errshow
mbRet = MW.Create_File_Psam(geU_CreateMF, "FFFFFFFFFFFFFFFF0f011234567890")
If Not mbRet Then MsgBox MW.Errshow: Exit Sub
'建ATR文件
mbRet = MW.Create_File_Psam(geU_CreateEF, "0001040ff0000a")
If Not mbRet Then MsgBox MW.Errshow: Exit Sub
mbRet = MW.Asc_To_Hex("03000000000000000020", pbIn(0), 10)
If Not mbRet Then MsgBox MW.Errshow: Exit Sub
'写ATR文件
mbRet = MW.Update_Binary_Psam(geU_Data, "81", 0, 10, pbIn())
If Not mbRet Then MsgBox MW.Errshow: Exit Sub
'建KEY文件
mbRet = MW.Create_File_Psam(geU_CreateEF, "00020511001019")
If Not mbRet Then MsgBox MW.Errshow: Exit Sub
'安装KEY
mbRet = MW.Write_Key_Psam(geU_WordInstall, "", psTransCode, "0100000001113312345678901234567890123456789012")
If Not mbRet Then MsgBox MW.Errshow: Exit Sub
mbRet = MW.Write_Key_Psam(geU_WordInstall, "", "12345678901234567890123456789012", "0200000001113312345678901234567890123456789012")
If Not mbRet Then MsgBox MW.Errshow: Exit Sub
Dim psRet As String
mbRet = MW.Sam_OUT_KEY_Psam("80", "01", "1234567890123456", psRet)
If Not mbRet Then MsgBox MW.Errshow: Exit Sub
mbRet = MW.Write_Key_Psam(geU_WordInstall, "", "12345678901234567890123456789012", "01008D11001100" + psRet)
If Not mbRet Then MsgBox MW.Errshow: Exit Sub
mbRet = MW.Write_Key_Psam(geU_WordInstall, "", "12345678901234567890123456789012", "01000E110011FF12345678901234567890123456789012")
If Not mbRet Then MsgBox MW.Errshow: Exit Sub
mbRet = MW.Write_Key_Psam(geU_WordInstall, "", "12345678901234567890123456789012", "010001110011FF12345678901234567890123456789012")
If Not mbRet Then MsgBox MW.Errshow: Exit Sub
'建文件1
mbRet = MW.Create_File_Psam(geU_CreateEF, "00030011110020")
If Not mbRet Then MsgBox MW.Errshow: Exit Sub
'写文件1
Dim pbCardInfo(32) As Byte
mbRet = MW.Asc_To_Hex("01" + Format(Now, "yyyymmdd") + "1234567890", pbCardInfo(0), 10)
If Not mbRet Then MsgBox MW.Errshow: Exit Sub
mbRet = MW.Update_Binary_Psam(geU_Data, "83", 0, 10, pbCardInfo())
If Not mbRet Then MsgBox MW.Errshow: Exit Sub
mbRet = MW.Create_File_Psam(geU_CreateEndMF, "")
If Not mbRet Then MsgBox MW.Errshow: Exit Sub
'第五步:建主密钥认证卡.
MsgBox "主密钥卡已生成,请在上卡座插入要发行的主密钥认证卡", vbInformation, "提示信息"
mbRet = MW.Reset
If Not mbRet Then MsgBox MW.Errshow: Exit Sub
mbRet = MW.Delete
If Not mbRet Then MsgBox MW.Errshow
mbRet = MW.Create_File_Psam(geU_CreateMF, "FFFFFFFFFFFFFFFF0f011234567890")
If Not mbRet Then MsgBox MW.Errshow: Exit Sub
'建ATR文件
mbRet = MW.Create_File_Psam(geU_CreateEF, "0001040ff0000a")
If Not mbRet Then MsgBox MW.Errshow: Exit Sub
mbRet = MW.Asc_To_Hex("04000000000000000021", pbIn(0), 10)
If Not mbRet Then MsgBox MW.Errshow: Exit Sub
'写ATR文件
mbRet = MW.Update_Binary_Psam(geU_Data, "81", 0, 10, pbIn())
If Not mbRet Then MsgBox MW.Errshow: Exit Sub
'建KEY文件
mbRet = MW.Create_File_Psam(geU_CreateEF, "00020511001019")
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -