根据网络资料整改,来源未知,已调试通过.

Option Explicit
Private Declare Function CryptAcquireContext Lib "advapi32.dll" _
Alias "CryptAcquireContextA" ( _
ByRef phProv As Long, _
ByVal pszContainer As String, _
ByVal pszProvider As String, _
ByVal dwProvType As Long, _
ByVal dwFlags As Long) As Long Private Declare Function CryptReleaseContext Lib "advapi32.dll" ( _
ByVal hProv As Long, _
ByVal dwFlags As Long) As Long Private Declare Function CryptCreateHash Lib "advapi32.dll" ( _
ByVal hProv As Long, _
ByVal Algid As Long, _
ByVal hKey As Long, _
ByVal dwFlags As Long, _
ByRef phHash As Long) As Long Private Declare Function CryptDestroyHash Lib "advapi32.dll" ( _
ByVal hHash As Long) As Long Private Declare Function CryptHashData Lib "advapi32.dll" ( _
ByVal hHash As Long, _
pbData As Any, _
ByVal dwDataLen As Long, _
ByVal dwFlags As Long) As Long Private Declare Function CryptDeriveKey Lib "advapi32.dll" ( _
ByVal hProv As Long, _
ByVal Algid As Long, _
ByVal hBaseData As Long, _
ByVal dwFlags As Long, _
ByRef phKey As Long) As Long Private Declare Function CryptDestroyKey Lib "advapi32.dll" ( _
ByVal hKey As Long) As Long Private Declare Function CryptEncrypt Lib "advapi32.dll" ( _
ByVal hKey As Long, _
ByVal hHash As Long, _
ByVal Final As Long, _
ByVal dwFlags As Long, _
pbData As Any, _
ByRef pdwDataLen As Long, _
ByVal dwBufLen As Long) As Long Private Declare Function CryptDecrypt Lib "advapi32.dll" ( _
ByVal hKey As Long, _
ByVal hHash As Long, _
ByVal Final As Long, _
ByVal dwFlags As Long, _
pbData As Any, _
ByRef pdwDataLen As Long) As Long Private Declare Sub MoveMemory Lib "kernel32" Alias "RtlMoveMemory" ( _
Dest As Any, _
Src As Any, _
ByVal Ln As Long) Private Const PROV_RSA_FULL = Private Const CRYPT_NEWKEYSET = &H8 Private Const ALG_CLASS_HASH =
Private Const ALG_CLASS_DATA_ENCRYPT = & Private Const ALG_TYPE_ANY =
Private Const ALG_TYPE_BLOCK = &
Private Const ALG_TYPE_STREAM = & Private Const ALG_SID_MD2 =
Private Const ALG_SID_MD4 =
Private Const ALG_SID_MD5 =
Private Const ALG_SID_SHA1 = Private Const ALG_SID_DES =
Private Const ALG_SID_3DES =
Private Const ALG_SID_RC2 =
Private Const ALG_SID_RC4 =
Enum HASHALGORITHM
MD2 = ALG_CLASS_HASH Or ALG_TYPE_ANY Or ALG_SID_MD2
MD4 = ALG_CLASS_HASH Or ALG_TYPE_ANY Or ALG_SID_MD4
MD5 = ALG_CLASS_HASH Or ALG_TYPE_ANY Or ALG_SID_MD5
SHA1 = ALG_CLASS_HASH Or ALG_TYPE_ANY Or ALG_SID_SHA1
End Enum
Enum ENCALGORITHM
DES = ALG_CLASS_DATA_ENCRYPT Or ALG_TYPE_BLOCK Or ALG_SID_DES
[3DES] = ALG_CLASS_DATA_ENCRYPT Or ALG_TYPE_BLOCK Or ALG_SID_3DES
RC2 = ALG_CLASS_DATA_ENCRYPT Or ALG_TYPE_BLOCK Or ALG_SID_RC2
RC4 = ALG_CLASS_DATA_ENCRYPT Or ALG_TYPE_STREAM Or ALG_SID_RC4
End Enum Dim HexMatrix(, ) As Byte
'================================================
'加密
'================================================
Public Function EncryptString(ByVal str As String, password As String) As String
Dim byt() As Byte
Dim HASHALGORITHM As HASHALGORITHM
Dim ENCALGORITHM As ENCALGORITHM
byt = str
HASHALGORITHM = MD5
ENCALGORITHM = RC4
EncryptString = BytesToHex(Encrypt(byt, password, HASHALGORITHM, ENCALGORITHM))
End Function
Public Function EncryptByte(byt() As Byte, password As String) As Byte()
Dim HASHALGORITHM As HASHALGORITHM
Dim ENCALGORITHM As ENCALGORITHM
HASHALGORITHM = MD5
ENCALGORITHM = RC4
EncryptByte = Encrypt(byt, password, HASHALGORITHM, ENCALGORITHM)
End Function
Private Function Encrypt(data() As Byte, ByVal password As String, Optional ByVal HASHALGORITHM As HASHALGORITHM = MD5, Optional ByVal ENCALGORITHM As ENCALGORITHM = RC4) As Byte()
Dim lRes As Long
Dim hProv As Long
Dim hHash As Long
Dim hKey As Long
Dim lBufLen As Long
Dim lDataLen As Long
Dim abData() As Byte
lRes = CryptAcquireContext(hProv, vbNullString, vbNullString, PROV_RSA_FULL, )
If lRes = And Err.LastDllError = &H80090016 Then lRes = CryptAcquireContext(hProv, vbNullString, vbNullString, PROV_RSA_FULL, CRYPT_NEWKEYSET)
If lRes <> Then
lRes = CryptCreateHash(hProv, HASHALGORITHM, , , hHash)
If lRes <> Then
lRes = CryptHashData(hHash, ByVal password, Len(password), )
If lRes <> Then
lRes = CryptDeriveKey(hProv, ENCALGORITHM, hHash, , hKey)
If lRes <> Then
lBufLen = UBound(data) - LBound(data) +
lDataLen = lBufLen
lRes = CryptEncrypt(hKey, &, , , ByVal &, lBufLen, )
If lRes <> Then
If lBufLen < lDataLen Then lBufLen = lDataLen
ReDim abData( To lBufLen - )
MoveMemory abData(), data(LBound(data)), lDataLen
lRes = CryptEncrypt(hKey, &, , , abData(), lBufLen, lDataLen)
If lRes <> Then
If lDataLen <> lBufLen Then ReDim Preserve abData( To lBufLen - )
Encrypt = abData
End If
End If
End If
CryptDestroyKey hKey
End If
CryptDestroyHash hHash
End If
CryptReleaseContext hProv,
End If
If lRes = Then Err.Raise Err.LastDllError
End Function
'================================================
'解密
'================================================
Public Function DecryptString(ByVal str As String, password As String) As String
Dim byt() As Byte
Dim HASHALGORITHM As HASHALGORITHM
Dim ENCALGORITHM As ENCALGORITHM
byt = HexToBytes(str)
HASHALGORITHM = MD5
ENCALGORITHM = RC4
DecryptString = Decrypt(byt, password, HASHALGORITHM, ENCALGORITHM)
End Function
Public Function DecryptByte(byt() As Byte, password As String) As Byte()
Dim HASHALGORITHM As HASHALGORITHM
Dim ENCALGORITHM As ENCALGORITHM
HASHALGORITHM = MD5
ENCALGORITHM = RC4
DecryptByte = Decrypt(byt, password, HASHALGORITHM, ENCALGORITHM)
End Function
Private Function Decrypt(data() As Byte, ByVal password As String, Optional ByVal HASHALGORITHM As HASHALGORITHM = MD5, Optional ByVal ENCALGORITHM As ENCALGORITHM = RC4) As Byte()
Dim lRes As Long
Dim hProv As Long
Dim hHash As Long
Dim hKey As Long
Dim lBufLen As Long
Dim abData() As Byte
lRes = CryptAcquireContext(hProv, vbNullString, vbNullString, PROV_RSA_FULL, )
If lRes = And Err.LastDllError = &H80090016 Then lRes = CryptAcquireContext(hProv, vbNullString, vbNullString, PROV_RSA_FULL, CRYPT_NEWKEYSET)
If lRes <> Then
lRes = CryptCreateHash(hProv, HASHALGORITHM, , , hHash)
If lRes <> Then
lRes = CryptHashData(hHash, ByVal password, Len(password), )
If lRes <> Then
lRes = CryptDeriveKey(hProv, ENCALGORITHM, hHash, , hKey)
If lRes <> Then
lBufLen = UBound(data) - LBound(data) +
ReDim abData( To lBufLen - )
MoveMemory abData(), data(LBound(data)), lBufLen
lRes = CryptDecrypt(hKey, &, , , abData(), lBufLen)
If lRes <> Then
ReDim Preserve abData( To lBufLen - )
Decrypt = abData
End If
End If
CryptDestroyKey hKey
End If
CryptDestroyHash hHash
End If
CryptReleaseContext hProv,
End If
If lRes = Then Err.Raise Err.LastDllError
End Function '================================================
'字节与十六进制字符串的转换
'================================================
Public Function BytesToHex(bits() As Byte) As String
Dim i As Long
Dim b
Dim s As String
For Each b In bits
If b < Then
s = s & "" & Hex(b)
Else
s = s & Hex(b)
End If
Next
BytesToHex = s
End Function
Public Function HexToBytes(sHex As String) As Byte()
Dim b() As Byte
Dim rst() As Byte
Dim i As Long
Dim n As Long
Dim m1 As Byte
Dim m2 As Byte
If HexMatrix(, ) = Then Call MatrixInitialize
b = StrConv(sHex, vbFromUnicode)
i = (UBound(b) + ) / -
ReDim rst(i)
For i = To UBound(b) Step
If b(i) > Then
m1 = b(i) -
ElseIf b(i) > Then
m1 = b(i) -
ElseIf b(i) > Then
m1 = b(i) -
End If
If b(i + ) > Then
m2 = b(i + ) -
ElseIf b(i + ) > Then
m2 = b(i + ) -
ElseIf b(i + ) > Then
m2 = b(i + ) -
End If
rst(n) = HexMatrix(m1, m2)
n = n +
Next i
HexToBytes = rst
End Function
Private Sub MatrixInitialize()
HexMatrix(, ) = &H0: HexMatrix(, ) = &H1: HexMatrix(, ) = &H2: HexMatrix(, ) = &H3: HexMatrix(, ) = &H4: HexMatrix(, ) = &H5: HexMatrix(, ) = &H6: HexMatrix(, ) = &H7
HexMatrix(, ) = &H8: HexMatrix(, ) = &H9: HexMatrix(, ) = &HA: HexMatrix(, ) = &HB: HexMatrix(, ) = &HC: HexMatrix(, ) = &HD: HexMatrix(, ) = &HE: HexMatrix(, ) = &HF
HexMatrix(, ) = &H10: HexMatrix(, ) = &H11: HexMatrix(, ) = &H12: HexMatrix(, ) = &H13: HexMatrix(, ) = &H14: HexMatrix(, ) = &H15: HexMatrix(, ) = &H16: HexMatrix(, ) = &H17
HexMatrix(, ) = &H18: HexMatrix(, ) = &H19: HexMatrix(, ) = &H1A: HexMatrix(, ) = &H1B: HexMatrix(, ) = &H1C: HexMatrix(, ) = &H1D: HexMatrix(, ) = &H1E: HexMatrix(, ) = &H1F
HexMatrix(, ) = &H20: HexMatrix(, ) = &H21: HexMatrix(, ) = &H22: HexMatrix(, ) = &H23: HexMatrix(, ) = &H24: HexMatrix(, ) = &H25: HexMatrix(, ) = &H26: HexMatrix(, ) = &H27
HexMatrix(, ) = &H28: HexMatrix(, ) = &H29: HexMatrix(, ) = &H2A: HexMatrix(, ) = &H2B: HexMatrix(, ) = &H2C: HexMatrix(, ) = &H2D: HexMatrix(, ) = &H2E: HexMatrix(, ) = &H2F
HexMatrix(, ) = &H30: HexMatrix(, ) = &H31: HexMatrix(, ) = &H32: HexMatrix(, ) = &H33: HexMatrix(, ) = &H34: HexMatrix(, ) = &H35: HexMatrix(, ) = &H36: HexMatrix(, ) = &H37
HexMatrix(, ) = &H38: HexMatrix(, ) = &H39: HexMatrix(, ) = &H3A: HexMatrix(, ) = &H3B: HexMatrix(, ) = &H3C: HexMatrix(, ) = &H3D: HexMatrix(, ) = &H3E: HexMatrix(, ) = &H3F
HexMatrix(, ) = &H40: HexMatrix(, ) = &H41: HexMatrix(, ) = &H42: HexMatrix(, ) = &H43: HexMatrix(, ) = &H44: HexMatrix(, ) = &H45: HexMatrix(, ) = &H46: HexMatrix(, ) = &H47
HexMatrix(, ) = &H48: HexMatrix(, ) = &H49: HexMatrix(, ) = &H4A: HexMatrix(, ) = &H4B: HexMatrix(, ) = &H4C: HexMatrix(, ) = &H4D: HexMatrix(, ) = &H4E: HexMatrix(, ) = &H4F
HexMatrix(, ) = &H50: HexMatrix(, ) = &H51: HexMatrix(, ) = &H52: HexMatrix(, ) = &H53: HexMatrix(, ) = &H54: HexMatrix(, ) = &H55: HexMatrix(, ) = &H56: HexMatrix(, ) = &H57
HexMatrix(, ) = &H58: HexMatrix(, ) = &H59: HexMatrix(, ) = &H5A: HexMatrix(, ) = &H5B: HexMatrix(, ) = &H5C: HexMatrix(, ) = &H5D: HexMatrix(, ) = &H5E: HexMatrix(, ) = &H5F
HexMatrix(, ) = &H60: HexMatrix(, ) = &H61: HexMatrix(, ) = &H62: HexMatrix(, ) = &H63: HexMatrix(, ) = &H64: HexMatrix(, ) = &H65: HexMatrix(, ) = &H66: HexMatrix(, ) = &H67
HexMatrix(, ) = &H68: HexMatrix(, ) = &H69: HexMatrix(, ) = &H6A: HexMatrix(, ) = &H6B: HexMatrix(, ) = &H6C: HexMatrix(, ) = &H6D: HexMatrix(, ) = &H6E: HexMatrix(, ) = &H6F
HexMatrix(, ) = &H70: HexMatrix(, ) = &H71: HexMatrix(, ) = &H72: HexMatrix(, ) = &H73: HexMatrix(, ) = &H74: HexMatrix(, ) = &H75: HexMatrix(, ) = &H76: HexMatrix(, ) = &H77
HexMatrix(, ) = &H78: HexMatrix(, ) = &H79: HexMatrix(, ) = &H7A: HexMatrix(, ) = &H7B: HexMatrix(, ) = &H7C: HexMatrix(, ) = &H7D: HexMatrix(, ) = &H7E: HexMatrix(, ) = &H7F
HexMatrix(, ) = &H80: HexMatrix(, ) = &H81: HexMatrix(, ) = &H82: HexMatrix(, ) = &H83: HexMatrix(, ) = &H84: HexMatrix(, ) = &H85: HexMatrix(, ) = &H86: HexMatrix(, ) = &H87
HexMatrix(, ) = &H88: HexMatrix(, ) = &H89: HexMatrix(, ) = &H8A: HexMatrix(, ) = &H8B: HexMatrix(, ) = &H8C: HexMatrix(, ) = &H8D: HexMatrix(, ) = &H8E: HexMatrix(, ) = &H8F
HexMatrix(, ) = &H90: HexMatrix(, ) = &H91: HexMatrix(, ) = &H92: HexMatrix(, ) = &H93: HexMatrix(, ) = &H94: HexMatrix(, ) = &H95: HexMatrix(, ) = &H96: HexMatrix(, ) = &H97
HexMatrix(, ) = &H98: HexMatrix(, ) = &H99: HexMatrix(, ) = &H9A: HexMatrix(, ) = &H9B: HexMatrix(, ) = &H9C: HexMatrix(, ) = &H9D: HexMatrix(, ) = &H9E: HexMatrix(, ) = &H9F
HexMatrix(, ) = &HA0: HexMatrix(, ) = &HA1: HexMatrix(, ) = &HA2: HexMatrix(, ) = &HA3: HexMatrix(, ) = &HA4: HexMatrix(, ) = &HA5: HexMatrix(, ) = &HA6: HexMatrix(, ) = &HA7
HexMatrix(, ) = &HA8: HexMatrix(, ) = &HA9: HexMatrix(, ) = &HAA: HexMatrix(, ) = &HAB: HexMatrix(, ) = &HAC: HexMatrix(, ) = &HAD: HexMatrix(, ) = &HAE: HexMatrix(, ) = &HAF
HexMatrix(, ) = &HB0: HexMatrix(, ) = &HB1: HexMatrix(, ) = &HB2: HexMatrix(, ) = &HB3: HexMatrix(, ) = &HB4: HexMatrix(, ) = &HB5: HexMatrix(, ) = &HB6: HexMatrix(, ) = &HB7
HexMatrix(, ) = &HB8: HexMatrix(, ) = &HB9: HexMatrix(, ) = &HBA: HexMatrix(, ) = &HBB: HexMatrix(, ) = &HBC: HexMatrix(, ) = &HBD: HexMatrix(, ) = &HBE: HexMatrix(, ) = &HBF
HexMatrix(, ) = &HC0: HexMatrix(, ) = &HC1: HexMatrix(, ) = &HC2: HexMatrix(, ) = &HC3: HexMatrix(, ) = &HC4: HexMatrix(, ) = &HC5: HexMatrix(, ) = &HC6: HexMatrix(, ) = &HC7
HexMatrix(, ) = &HC8: HexMatrix(, ) = &HC9: HexMatrix(, ) = &HCA: HexMatrix(, ) = &HCB: HexMatrix(, ) = &HCC: HexMatrix(, ) = &HCD: HexMatrix(, ) = &HCE: HexMatrix(, ) = &HCF
HexMatrix(, ) = &HD0: HexMatrix(, ) = &HD1: HexMatrix(, ) = &HD2: HexMatrix(, ) = &HD3: HexMatrix(, ) = &HD4: HexMatrix(, ) = &HD5: HexMatrix(, ) = &HD6: HexMatrix(, ) = &HD7
HexMatrix(, ) = &HD8: HexMatrix(, ) = &HD9: HexMatrix(, ) = &HDA: HexMatrix(, ) = &HDB: HexMatrix(, ) = &HDC: HexMatrix(, ) = &HDD: HexMatrix(, ) = &HDE: HexMatrix(, ) = &HDF
HexMatrix(, ) = &HE0: HexMatrix(, ) = &HE1: HexMatrix(, ) = &HE2: HexMatrix(, ) = &HE3: HexMatrix(, ) = &HE4: HexMatrix(, ) = &HE5: HexMatrix(, ) = &HE6: HexMatrix(, ) = &HE7
HexMatrix(, ) = &HE8: HexMatrix(, ) = &HE9: HexMatrix(, ) = &HEA: HexMatrix(, ) = &HEB: HexMatrix(, ) = &HEC: HexMatrix(, ) = &HED: HexMatrix(, ) = &HEE: HexMatrix(, ) = &HEF
HexMatrix(, ) = &HF0: HexMatrix(, ) = &HF1: HexMatrix(, ) = &HF2: HexMatrix(, ) = &HF3: HexMatrix(, ) = &HF4: HexMatrix(, ) = &HF5: HexMatrix(, ) = &HF6: HexMatrix(, ) = &HF7
HexMatrix(, ) = &HF8: HexMatrix(, ) = &HF9: HexMatrix(, ) = &HFA: HexMatrix(, ) = &HFB: HexMatrix(, ) = &HFC: HexMatrix(, ) = &HFD: HexMatrix(, ) = &HFE: HexMatrix(, ) = &HFF
End Sub

测试代码:

Private Sub Command1_Click()
Dim bs() As Byte, be() As Byte, bd() As Byte
bs = StrConv("", vbFromUnicode)
be = EncryptByte(bs, "password")
bd = DecryptByte(be, "password")
Dim s1 As String, s2 As String, s3 As String
s1 = BytesToHex(bs)
s2 = BytesToHex(be)
s3 = BytesToHex(bd)
Print "原始字节:" & s1 & " (len:" & Len(s1) / & ")"
Print "加密字节:" & s2 & " (len:" & Len(s2) & ")"
Print "解密字节:" & s3 & " (len:" & Len(s3) & ")"
Print "--------------------------------"
Dim ss As String, se As String, sd As String
ss = "MD5加/解密"
se = EncryptString(ss, "password")
sd = DecryptString(se, "password")
Print "原文:" & ss & " (len:" & LenB(ss) & ")"
Print "加密:" & se & " (len:" & Len(se) & ")"
Print "解密:" & sd & " (len:" & LenB(sd) & ")"
End Sub

VB使用API进行RC4加密解密(MD5密钥)的更多相关文章

  1. RC4加密解密算法

    RC4相对是速度快.安全性高的加密算法.在实际应用中,我们可以对安全系数要求高的文本进行多重加密,这样破解就有一定困难了.如下测试给出了先用RC4加密,然后再次用BASE64编码,这样双重锁定,保证数 ...

  2. DES加密解密 MD5加密解密

    #region MD5 加密 /// <summary> /// MD5加密静态方法 /// </summary> /// <param name="Encry ...

  3. [C#]加密解密 MD5、AES

    /// <summary> /// MD5函数 /// </summary> /// <param name="str">原始字符串</p ...

  4. java RC4加密解密

    package com.dgut.app.utils; import java.lang.Byte; import java.util.UUID; public class RC4 { public ...

  5. RC4加密解密

    package util; public class RC4Util { public static String decry_RC4(byte[] data, String key) { if (d ...

  6. C#加密解密(DES,AES,Base64,md5,SHA256,RSA,RC4)

    一:异或^简单加解密(数字类型) 1:原理: 异或用于比较两个二进制数的相应位,在执行按位"异或"运算时,如果两个二进制数的相应位都为1或者都为0,则返回0;如果两个二进制数的相应 ...

  7. .net Xml加密解密操作

    生成密钥的方法: /// <summary>生成RSA加密 解密的 密钥 /// 生成的key就是 方法EncryptByRSA与DecryptByRSA用的key了 /// </s ...

  8. 用C#实现DES加密解密解决URL参数明文的问题

    啥也不说,直接上代码. 加密解码,封装到一个类,key可以自己修改. using System; using System.Security.Cryptography; using System.Te ...

  9. C# 对密码等数据进行对称性加密解密

    类: /// <summary> /// DESEncrypt加密解密算法. /// </summary> public class DESEncrypt { private ...

随机推荐

  1. 基本DFS与BFS算法(C++实现)

    样图: DFS:深度优先搜索,是一个不断探查和回溯的过程,每探查一步就将该步访问位置为true,接着在该点所有邻接节点中,找出尚未访问过的一个,将其作为下个探查的目标,接着对这个目标进行相同的操作,直 ...

  2. JAVA进阶20

    1.可视化日历程序(简陋版) package cn.zh.abstrac; import java.text.DateFormat; import java.text.ParseException; ...

  3. Excel如何快速统计一列中相同数值出现的个数--数据透视表

    excel如何快速统计一列中相同数值出现的个数_百度经验 --这里介绍了两种解决方式,用第一种https://jingyan.baidu.com/article/9113f81b2c16822b321 ...

  4. United States Department of Agriculture 美国农业部网站数据自动下载小脚本

    帮对象写的自动点击页面的小脚本,如果有需要的可以试试,(#^.^#) https://apps.fas.usda.gov/gats/ExpressQuery1.aspx var year = '199 ...

  5. Linux使用CFSSL自签TLS证书

    ⒈安装CFSSL wget https://pkg.cfssl.org/R1.2/cfssl_linux-amd64 wget https://pkg.cfssl.org/R1.2/cfssljson ...

  6. Ansible运维自动化工具19个常用模块使用实例【转】

    一.模块列表 1.setup 2.ping 3.file 4.copy 5.command 6.shell 7.script 8.cron 9.yum 10.service 11.group 12.u ...

  7. 从头开始学gradle【各系统安装gradle】

    所有的环境都是基于jdk1.8 java -version windows安装 下载对应的gradle.zip安装包,解压到指定文件即可,然后配置相应的环境变量即可使用 linux/mac 安装 mk ...

  8. 【彻底解决】django migrate (mysql.W002) 【专治强迫症】

    cmd中使用python3 manage.py migrate命令,报warn,很多人都遇到过 解决办法: settings.py文件夹加入DATABASES['OPTIONS']['init_com ...

  9. Django组件-Forms组件

    Django的Forms组件主要有以下几大功能: 页面初始化,生成HTML标签 校验用户数据(显示错误信息) HTML Form提交保留上次提交数据 一.小试牛刀 1.定义Form类 from dja ...

  10. C#应用编程小例子-03-展示另一个窗体

    C#应用编程小例子-03-展示另一个窗体 using System; using System.Collections.Generic; using System.ComponentModel; us ...