Es scheint nicht viele Verschlüsselungsmethoden in ASP zu geben. Basierend auf den Informationen des Seniors werden die Verschlüsselungs- und Entschlüsselungsfunktionen in ASP sortiert.
RSA.asp
<%
REM implementiert Verschlüsselung und Entschlüsselung in ASP, Verschlüsselungsmethode: Gemäß RSA
REM -Kontakt: [email protected]
Classclsrsa
PublicPrivateKey
PublicPublickey
Öffentlichmodulus
PublicFunctionCrypt (plngmessage, plngkey)
OnErrorresumeNext
Dimllngmod
Dimllngresult
Dimllngindex
IFPLNGKEYMOD2 = 0Then
llngresult = 1
Forllngindex = 1ToPlngkey/2
llngmod = (plngmessage^2) modmodulus
'ModmayErroronKeyGeneration
llngresult = (llngmod*llngresult) modmodulus
Isterrthenexitfunction
Nächste
Anders
llngresult = plngmessage
Forllngindex = 1ToPlngkey/2
llngmod = (plngmessage^2) modmodulus
OnErrorresumeNext
'ModmayErroronKeyGeneration
llngresult = (llngmod*llngresult) modmodulus
Isterrthenexitfunction
Nächste
Endif
Crypt = llngresult
Endfunktion
PublicFunctioncode (byvalpstrMessage)
Dimllngindex
DimllngmaxIndex
Dimlbytascii
Dimllngencrypted
llngmaxIndex = len (pstrmessage)
IfllngMaxIndex = 0Thenexitfunction
Forllngindex = 1tollngmaxIndex
LBYTASCII = ASC (Mid (PstrMessage, llngindex, 1))
llngencrypted = crypt (lbytascii, publicKey)
Codode = codieren & numbertohex (llngencrypted, 4)
Nächste
Endfunktion
PublicFunctionDecode (ByvalpstrMessage)
Dimlbytascii
Dimllngindex
DimllngmaxIndex
DimllngencryptedData
Decodode = ""
llngmaxIndex = len (pstrmessage)
Forllngindex = 1tollngmaxIndexstep4