【调度系统】广东民航医疗快线调度系统源代码
hzj
2025-07-09 4418374d26a16ec759e06059c2b1fedabe1827e6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
<!--#include file="CBase64.asp"-->
<!--#include file="ClassBase64Encode.asp"-->
 
<%
Class ClassCryptoAES
'Useage:
'Dim cls
'Set cls=new ClassCryptoAES
'cls.EncodingAESKey="eX8nNDRGOPHfdoeY1nDdnx6qEc5pqWi2eGTx2eD2V8n"
'cls.Encode("TargetString")
'cls.Decode("TargetString")
 
 
    Private cfgAESKey
    Private cfgEncodingAESKey
    Private m_ClassBase64Encode
    Private m_objRijndaelManaged
    Private m_objUTF8Encoding
    Private m_enc
    Private m_dec
    
    
    Private Sub Class_Initialize
        'Set m_ClassBase64Encode=new ClassBase64Encode
        Set m_ClassBase64Encode=new CBase64
        Set m_objRijndaelManaged=server.CreateObject("System.Security.Cryptography.RijndaelManaged")
        Set m_objUTF8Encoding=server.CreateObject("System.Text.UTF8Encoding")
    End Sub
    
    Private Sub Class_Terminate()
        set m_enc= Nothing    
        set m_dec= Nothing    
        Set m_ClassBase64Encode=Nothing
        Set m_objRijndaelManaged=Nothing
        Set m_objUTF8Encoding=Nothing        
    End Sub
 
    Public Property Let EncodingAESKey(ByVal field)
        cfgEncodingAESKey = field        
        'cfgAESKey=m_ClassBase64Encode.Decode64(cfgEncodingAESKey + "=")    
        cfgAESKey=m_ClassBase64Encode.DecodeText(cfgEncodingAESKey + "=")    
        Call SetCryptoIVandKey()
    End Property
 
    Public Property Get EncodingAESKey
        EncodingAESKey = cfgEncodingAESKey
    End Property
 
Public Function Encode(s)
    Dim bytes
    
    bytes=m_objUTF8Encoding.GetBytes_4(s)
    bytec=m_enc.TransformFinalBlock((bytes),0,lenb(bytes))
    
    'Encode=m_objUTF8Encoding.GetString((bytec))    
    Encode=Bytes2Str(bytec,"unicode")
End Function
 
Private Sub toString(arr)
    
    response.Write( Bytes2BSTR(arr) & "<hr>")
End Sub
 
Public Function Decode(s)
    Dim bytec,byted
    'bytec=m_objUTF8Encoding.GetBytes_4(s)
    'bytec=Str2Bytes(m_ClassBase64Encode.Decode64(s),"unicode")
    bytec=Str2Bytes(s,"unicode")
    'toString(bytec)    
    byted=m_dec.TransformFinalBlock((bytec),0,lenb(bytec))
    
    'toString(byted)    
    Decode=m_objUTF8Encoding.GetString((byted))
End Function
 
 
Private Sub SetCryptoIVandKey()
'Set IV and key
    m_objRijndaelManaged.IV=GetBytes(cfgAESKey,0,16)
    m_objRijndaelManaged.key=GetBytes(cfgAESKey,0,32)
    set m_enc= m_objRijndaelManaged.CreateEncryptor()
    set m_dec= m_objRijndaelManaged.CreateDecryptor()    
End Sub
 
    Public Function GetBytes(byval str,istart,iLen)
            Dim ms,strRet
            Set ms = CreateObject("ADODB.Stream") 
            ms.Type = 2           
            ms.Charset = "utf-8"  
            ms.Open                    
            ms.WriteText str          
            
            ms.Position = 0         
            ms.Type = 1            
            
            ms.Position = istart+3
            vout = ms.Read(iLen)    
            ms.close             
            Set ms = nothing
            GetBytes = vout
    End Function
 
    Function Bytes2BSTR(vin)
        Bytes2BSTR = Bytes2Str(vin,"utf-8")
    End Function
 
  Public  Function Bytes2Str(vin,charset)
        Dim ms,strRet
        Set ms = Server.CreateObject("ADODB.Stream")    '建立流对象
        ms.Type = 1             ' Binary
        ms.Open                    
        ms.Write vin            '把vin写入流对象中
        
        ms.Position = 0         '设置流对象的起始位置是0 以设置Charset属性
        ms.Type = 2              'Text
        ms.Charset = charset    '设置流对象的编码方式为 charset
 
        strRet = ms.ReadText    '取字符流
        ms.close                '关闭流对象
        Set ms = nothing
        Bytes2Str = strRet
    End Function
    
   Public Function Str2Bytes(str,charset)
        Dim ms,strRet
        Set ms = CreateObject("ADODB.Stream")    '建立流对象
        ms.Type = 2             ' Text
        ms.Charset = charset    '设置流对象的编码方式为 charset
        ms.Open                    
        ms.WriteText str            '把str写入流对象中
        
        ms.Position = 0         '设置流对象的起始位置是0 以设置Charset属性
        ms.Type = 1              'Binary
        
        ms.Position = 2            '跳过0-1字节,不同的charset需跳过的位置不同
        vout = ms.Read(ms.Size)    '取字符流
        ms.close                '关闭流对象
        Set ms = nothing
        Str2Bytes = vout
    End Function
    
    
    Public Function toBase64(s)
        'toBase64=m_ClassBase64Encode.Encode64(s)
        toBase64=m_ClassBase64Encode.EncodeText(s)
    End Function
    
    Public Function FromBase64(s)
        'FromBase64=m_ClassBase64Encode.Decode64(s)
        FromBase64=m_ClassBase64Encode.DecodeText(s)
    End Function
 
End Class
 
 
 
%>