Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Code Support: ASP (Non-Forum Related)
 Question please how to encrypt files asp
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

AHMEDHHH1
Junior Member

Egypt
105 Posts

Posted - 15 March 2013 :  17:14:53  Show Profile  Reply with Quote
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

Carefree
Advanced Member

Philippines
4207 Posts

Posted - 15 March 2013 :  21:10:47  Show Profile  Reply with Quote
Look at this example: Encoding Files Using ASP
Go to Top of Page

AHMEDHHH1
Junior Member

Egypt
105 Posts

Posted - 17 March 2013 :  14:15:49  Show Profile  Reply with Quote
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
Go to Top of Page

AHMEDHHH1
Junior Member

Egypt
105 Posts

Posted - 17 March 2013 :  14:51:40  Show Profile  Reply with Quote
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

Edited by - AHMEDHHH1 on 17 March 2013 14:53:13
Go to Top of Page

Carefree
Advanced Member

Philippines
4207 Posts

Posted - 17 March 2013 :  17:06:37  Show Profile  Reply with Quote
quote:
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.
Go to Top of Page

AHMEDHHH1
Junior Member

Egypt
105 Posts

Posted - 03 April 2013 :  15:46:21  Show Profile  Reply with Quote
Thank you Professor
Carefree

Edited by - AHMEDHHH1 on 04 April 2013 01:16:47
Go to Top of Page

Carefree
Advanced Member

Philippines
4207 Posts

Posted - 04 April 2013 :  04:15:19  Show Profile  Reply with Quote
Where is the link to the "p.asp" file? I can not detect the error without seeing the file.
Go to Top of Page

AHMEDHHH1
Junior Member

Egypt
105 Posts

Posted - 08 April 2013 :  16:10:50  Show Profile  Reply with Quote
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
Go to Top of Page

Carefree
Advanced Member

Philippines
4207 Posts

Posted - 08 April 2013 :  21:35:22  Show Profile  Reply with Quote
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.


<!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>"
%>

Edited by - Carefree on 10 June 2013 13:35:45
Go to Top of Page

AHMEDHHH1
Junior Member

Egypt
105 Posts

Posted - 09 April 2013 :  09:47:54  Show Profile  Reply with Quote
Thanks Professor
Carefree
Will be tested soon

Edited by - AHMEDHHH1 on 09 April 2013 09:54:35
Go to Top of Page

Carefree
Advanced Member

Philippines
4207 Posts

Posted - 10 June 2013 :  12:08:19  Show Profile  Reply with Quote
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?
Go to Top of Page

Carefree
Advanced Member

Philippines
4207 Posts

Posted - 13 August 2013 :  14:26:50  Show Profile  Reply with Quote
quote:
Originally posted by Carefree

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?



Didn't want to edit such an old reply, but my brain finally kicked in on this topic. You should be able to use Arabic, Chinese, Korean, etc. if you change the 3rd line in the code above from this:
Response.Charset="UTF-8"
to this:
Response.Charset="UTF-16"
I don't read Arabic, though, and cannot be sure whether the results are what I want.

Edited by - Carefree on 13 August 2013 14:56:26
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.16 seconds. Powered By: Snitz Forums 2000 Version 3.4.07