Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Community Forums
 Code Support: ASP (Non-Forum Related)
 Question please how to encrypt files asp

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!
Before posting, make sure you have read this topic!

Screensize:
UserName:
Password:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkInsert EmailInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
   

T O P I C    R E V I E W
AHMEDHHH1 Posted - 15 March 2013 : 17:14:53
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
11   L A T E S T    R E P L I E S    (Newest First)
Carefree Posted - 13 August 2013 : 14:26:50
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.
Carefree Posted - 10 June 2013 : 12:08:19
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?
AHMEDHHH1 Posted - 09 April 2013 : 09:47:54
Thanks Professor
Carefree
Will be tested soon
Carefree Posted - 08 April 2013 : 21:35:22
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>"
%>
AHMEDHHH1 Posted - 08 April 2013 : 16:10:50
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
Carefree Posted - 04 April 2013 : 04:15:19
Where is the link to the "p.asp" file? I can not detect the error without seeing the file.
AHMEDHHH1 Posted - 03 April 2013 : 15:46:21
Thank you Professor
Carefree
Carefree Posted - 17 March 2013 : 17:06:37
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.
AHMEDHHH1 Posted - 17 March 2013 : 14:51:40
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
AHMEDHHH1 Posted - 17 March 2013 : 14:15:49
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
Carefree Posted - 15 March 2013 : 21:10:47
Look at this example: Encoding Files Using ASP

Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.03 seconds. Powered By: Snitz Forums 2000 Version 3.4.07