Introduction First, please briefly introduce the background of the encryption. Due to the US prohibiting several cryptographic algorithms (eg, 40-bit encryption restrictions on SSL), this article will introduce an ASP that can be used in the simple character encryption algorithm, not those limited. In fact, the encryption algorithm introduced here is enough to decrypt people for a while for the general purpose. Its encryption basis is the simplest Vernum password method, I will introduce this password in the next article. Its basic principle is that there is a need to have a plain text that needs to be encrypted and a randomly generated decryption key file. Then use these two files to generate ciphertext. (Plaintext) combination (key) = encrypted ciphertext So this article describes the code that generates a key. We assume that we have a key to 512-bit keys, which is enough to encrypt a text character. The code is as follows: Keygen.asp file <% '******************************************* ************************* CONST G_KEYLOCATION = "c: /key.txt" const g_keylen = 512
ON Error ResMe next
Call writekeyTofile (Keygen (g_keylen), g_keylocation
IF Err <> 0 Then Response.Write "Error Generating Key." & "
" response.write err.number & "
" response.write err.description & "
" else response.write " Key successfully generated. "END IF
Sub WriteKeyToFile (MyKeyString, strFileName) Dim keyFile, fso set fso = Server.CreateObject ( "scripting.FileSystemObject") set keyFile = fso.CreateTextFile (strFileName, true) keyFile.WriteLine (MyKeyString) keyFile.Close End Sub
Function KeyGeN (iKeyLength) Dim k, iCount, strMyKey lowerbound = 35 upperbound = 96 Randomize 'Initialize random-number generator For I = 1 to iKeyLength s = 255 k = Int (((upperbound -. Lowerbound) 1) * Rnd LowerBound) strmykey = strmykey & chr (k) & "Next keygen = strmyKey End Function
%> Run the top of the key .asp page in IIS. You only need this to do this, he will write the key in the file C: /key.txt (if you like, you can also put this file in another more secure place). Then you can open this key .txt file, it will contain 512 ASCII code characters between 35 to 96. And because it is randomly generated, the private key files of each person will be different, the following is an example key file:
Iy /; $> = 3) ^ - 7M32 # q] Voii.q = OFMC`: p7_b;