Question please how to encrypt files asp - Posted (2115 Views)
Junior Member
AHMEDHHH1
Posts: 105
105
Question please how to encrypt files asp
Files will give whatever for one Ac_khas and will use it on a local server http://localhost/
And I want to protect the files from the use on another computer

What are the ways of protection that you advise me
 Sort direction, for dates DESC means newest first  
 Page size 
Posted
Advanced Member
Carefree
Posts: 4224
4224
Look at this example: Encoding Files Using ASP
Posted
Junior Member
AHMEDHHH1
Posts: 105
105
Is there a database inside Windows computer far from means Balramat or Albroossor
So as Windows has been deleted LOSE this information can be found to the device
+ Was found in what is on track
Is if you were adding this path will be identified as any database or has a special connection method and knock the introduction of private data
Posted
Junior Member
AHMEDHHH1
Posts: 105
105
How do I use the file encryption professor Carefree
For example, I want to encrypt a file (d. Asp)

Error Type:
Microsoft VBScript runtime (0x800A01F4)
Variable is undefined: 'WScript'
/fl/p.asp, line 8
Posted
Advanced Member
Carefree
Posts: 4224
4224
Originally posted by AHMEDHHH1
How do I use the file encryption professor Carefree
For example, I want to encrypt a file (d. Asp)

Error Type:
Microsoft VBScript runtime (0x800A01F4)
Variable is undefined: 'WScript'
/fl/p.asp, line 8

Post a link to your "p.asp" file in .txt format for us to look at.
Posted
Junior Member
AHMEDHHH1
Posts: 105
105
Thank you Professor
Carefree
Posted
Advanced Member
Carefree
Posts: 4224
4224
Where is the link to the "p.asp" file? I can not detect the error without seeing the file.
Posted
Junior Member
AHMEDHHH1
Posts: 105
105
The problem is that the language of Arabic this did not put the file because different language to Gatkm
I want to encrypt the file

http://pilot.somee.com/p.txt
Posted
Advanced Member
Carefree
Posts: 4224
4224
You would have to start by getting the values of the Arabic script into their Ascii equivalents. This program only supports the extended Ascii character set. After that, this should do it. This uses the "readfile" method (reads the entire contents into a variable in one piece), so there's a limit on how large it could be.
Put this into the folder with the text file to be encrypted. Make sure the folder has write permissions set for IUSR, IIS_IUSRS, & NETWORK SYSTEM.
This will read the text file and create two others. One will be the encrypted equivalent, the other will be the random keys necessary to
decrypt it again.
To encrypt, input the file name into the encrypt field.
To decrypt, simply put the key file ("-c suffix") into the same folder with the encrypted file ("-e suffix") and input the "-e" file name into the decrypt field.
Code:

<!DOCTYPE HTML>
<%
Response.Charset="UTF-8"
dim strText, strPath, FilePath
Const FSOForReading = 1
Const FSOForWriting = 2
If Request("encr")>"" Then
strPath=Request("encr")
strName=left(strPath,len(strPath)-4)
FilePath=Server.Mappath(strPath)
FilePath1=Server.Mappath(strName&"-e")&right(strPath,4)
FilePath2=Server.Mappath(strName&"-c")&right(strPath,4)
On Error Resume Next
Error.Clear
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
If objFSO.FileExists(FilePath1) Then
objFSO.DeleteFile(FilePath1)
End If
If objFSO.FileExists(FilePath2) Then
objFSO.DeleteFile(FilePath2)
End If
If objFSO.FileExists(FilePath) Then
Set objTextStream = objFSO.OpenTextFile(FilePath, FSOForReading)
Set objTextStream2 = objFSO.OpenTextFile(FilePath1,FSOForWriting,true)
Set objTextStream3 = objFSO.OpenTextFile(FilePath2,FSOForWriting,true)
End If
strText=objTextStream.ReadAll
For i = 1 to len(strText)
Randomize
j=int(Rnd*128)+1
If asc(mid(strText,i,1))>128 Then
objTextStream2.Write chr(asc(mid(strText,i,1))-j)
objTextStream3.Write -j&","
Else
objTextStream2.Write chr(asc(mid(strText,i,1))+j)
objTextStream3.Write j&","
End If
Next
objTextStream.Close
Set objTextStream = Nothing
objTextStream2.Close
Set objTextStream2 = Nothing
objTextStream3.Close
Set objTextStream3 = Nothing
Set objFSO = Nothing
Set objFSO = Nothing
Response.Write "<a href=""" & strName & "-e"&right(strPath,4)&""">Encrypted</a><br /><a href=""" & strName & "-c"&right(strPath,4)&""">Key File</a><br /><br />"
ElseIf Request("decr")>"" Then
strPath=Request("decr")
strName=left(strPath,len(strPath)-6)
FilePath=Server.Mappath(strPath)
FilePath1=Server.Mappath(strName&"-c")&right(strPath,4)
FilePath2=Server.Mappath(strName&"-d")&right(strPath,4)
On Error Resume Next
Error.Clear
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
If objFSO.FileExists(FilePath2) Then
objFSO.DeleteFile(FilePath2)
End If
If not objFSO.FileExists(FilePath1) Then
Response.Write "Key file not found."
Response.Write "<meta http-equiv=""Refresh"" content=""2; URL=Encrypt.asp"">"
Response.End
End If
If objFSO.FileExists(FilePath) Then
Set objTextStream = objFSO.OpenTextFile(FilePath, FSOForReading)
Set objTextStream2= objFSO.OpenTextFile(FilePath1,FSOForReading)
Set objTextStream3= objFSO.OpenTextFile(FilePath2,FSOForWriting,true)
End If
strText=objTextStream.ReadAll
strText2=objTextStream2.ReadAll
j=0
For i = 1 to len(strText2)
If not mid(strText2,i,1)="," Then
strCode=strCode&mid(strText2,i,1)
Else
j=j+1
objTextStream3.Write chr(asc(mid(strText,j,1))-strCode)
strCode=""
End If
Next
objTextStream.Close
Set objTextStream = Nothing
objTextStream2.Close
Set objTextStream2 = Nothing
objTextStream3.Close
Set objTextStream3 = Nothing
Set objFSO = Nothing
Response.Write "<a href=""" & strName&"-d"&right(strPath,4)&""">Decrypted</a><br /><br />"
End If
Response.Write "<form action=""encrypt.asp"" method=""get"">" & _
" Encrypt: <input type=""text"" name=""encr"" /><br />" & _
" Decrypt: <input type=""text"" name=""decr"" /><br />" & _
" <input type=""submit"" value=""submit"" />" & _
"</form>"
%>
Posted
Junior Member
AHMEDHHH1
Posts: 105
105
Thanks Professor
Carefree
Will be tested soon
Posted
Advanced Member
Carefree
Posts: 4224
4224
In regard to the code I posted above, I've been trying to make it support unicode characters; however, I've been singularly unsuccessful. AscW (vs Asc) doesn't work, but I know that Asc is the issue. Anyone have an idea?
You Must enter a message