• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 600
  • Last Modified:

using pgp encryption and cfexecute

Ok, I'm trying to use pgp encryption and need to run it using cfexecute.  Can; get it to work though.  So to run the file in dos command, it's..

GPG -r pub --output c:\gpg2\#Filename#.gpg --encrypt c:\gpg2\x\#Filename#

output = the name of the file and where to put it
encrypt = where the file is and the exact name
GPG = is where the gpg executable is (currently on root)
-r pub = are the arguments

How can I run the above using cfexecute?
0
COwebmaster
Asked:
COwebmaster
  • 15
  • 15
2 Solutions
 
_agx_Commented:
Try something like

<cfexecute name="c:\pathToTheFile\gpg.exe"
arguments="-r pub --output c:\gpg2\#Filename#.gpg --encrypt c:\gpg2\x\#Filename#"
>
0
 
COwebmasterAuthor Commented:
Ok, i tried that but the gpg file was not created.  So i have..

<cfexecute name="e:\[pathtoexe]\gpg2\gpg.exe" arguments="-r pub --output e:\[pathtowherethefilegoes]\gpg2\ek\CNV#counter##dateFormat(endDate,'mmdd')#.gpg --encrypt e:\[pathtowherethefileneedsencrypted]\CNV#counter##dateFormat(endDate,'mmdd')#"></cfexecute>
0
 
_agx_Commented:
Try these variations:

<cfset inputFile = "e:\[pathtowherethefileneedsencrypted]\CNV#counter##dateFormat(endDate,'mmdd')#">
<cfset outputFile = "e:\[pathtowherethefilegoes]\gpg2\ek\CNV#counter##dateFormat(endDate,'mmdd')#.gpg">

1.
<cfexecute name="e:\[pathtoexe]\gpg2\gpg.exe" arguments="-r pub --encrypt #inputFile# --output #outputFile#"></cfexecute>

2. Use cmd.exe
<cfexecute name="c:\windows\system32\cmd.exe"
arguments="e:\[pathtoexe]\gpg2\gpg.exe -r pub --encrypt #inputFile# --output #outputFile#"></cfexecute>

3. Explicit output file

<cfexecute name="e:\[pathtoexe]\gpg2\gpg.exe"
arguments=" -r pub --encrypt #inputFile#" outputFile="#outputFile#"></cfexecute>

Also - are you testing this locally where you can see the processes running in TaskManager?
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
COwebmasterAuthor Commented:
should the .gpg extension be on any of the paths, do you think?
0
 
COwebmasterAuthor Commented:
Also, prior to encrypting the file, I'm creating the file using..

<cffile action="append" addNewLine="yes" file="e:\[pathtofile]\CNV#counter##dateFormat(endDate,'mmdd')#" output="#mystring#">
0
 
_agx_Commented:
Yes, I think it should definitely be on the output file.

> Also, prior to encrypting the file, I'm creating the file using..

Since the file is unencrypted to start with, I don't think that should matter.   So are you testing locally?  Can you see what processes are running in the task manager?
0
 
COwebmasterAuthor Commented:
Ok, I tried adding in the extension yet the file outputs with no extension.
0
 
_agx_Commented:
So it is working?
0
 
_agx_Commented:
BTW, if it works from DOS you could alway wrap it up in a .bat file.  Then call the .bat file from cfexecute instead

www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:33660
0
 
COwebmasterAuthor Commented:
I tried that link but it doesn't work.
0
 
_agx_Commented:
Yes, they seem to be down for the moment.  Just paste the link into google and use the "cached" link, next to "Similar pages".

0
 
_agx_Commented:
The thread is using "echo", but the idea is the same.  Just put the syntax you know works into the bat file. But replace the file names  with %1 and %2


GPG.exe -r pub --output %1 --encrypt %2

Then call the bat file with cfexecute, and pass in the file paths as arguments.  Just make sure they are absolute paths:

<cfexecute name="c:\fullPathTo\yourBatFile.bat"
arguments="#firstFile# #secondFile#"
/>

0
 
COwebmasterAuthor Commented:
is %1 and %2 placeholders for the name of file?
0
 
_agx_Commented:
Yes.  It is like a DOS variable
0
 
COwebmasterAuthor Commented:
firstfile and secondfile would be the same name.  So, if the output file is..

CNV10420

Then..
<cfexecute name="c:\fullPathTo\yourBatFile.bat" arguments="CNV10420 CNV10420" />

in the bat file, i have..

GPG -r pub --output E:\[path]\%1 --encrypt E:\[path]\%2

Tried that but CNV10420.gpg was not created.
0
 
_agx_Commented:
Run the same code from a dos prompt (ie with the bat file)

ie c:\fullPathTo\yourBatFile.bat CNV10420 CNV10420

If it works, it may be some sort of permissions problem
http://forums.hostmysite.com/about1291.html&highlight=
0
 
COwebmasterAuthor Commented:
Ok, I'll try that.
0
 
COwebmasterAuthor Commented:
None of this seems to work
0
 
COwebmasterAuthor Commented:
I'm wondering if cfexecute is working at all.  Is there a simple comand I can place in the .bat file.  Then i'll hit the cfm page using cfexecute to see if it can return something or do something.
0
 
_agx_Commented:
Yes, try using ECHO.  It just echoes whatever text comes after it:

Example, from dos:
c:>  echo  "Does this work?"
0
 
COwebmasterAuthor Commented:
Ok, I can get the .bat file to run using cfexecute so that's good.  now, i just have to figure out why it's not creating that file.  what is a simple dos command that I can place in the .bat to move a file from one dir to another?
0
 
_agx_Commented:
c:> move c:\sourceDir\someFile.txt  c:\destDir\
0
 
_agx_Commented:
If cfexecute is working, it may be permissions problems with that particular program.  If you are running on a hosted site, you might ask your host about it.  They would probably know more about.
0
 
_agx_Commented:
> They would probably know more about.

Correction: They would probably know more about _it_
0
 
COwebmasterAuthor Commented:
I'm still researching this out.
0
 
COwebmasterAuthor Commented:
this still doesn't work.  I can't even get the cfexceute to work..  This is what I have on my cfm page..

<cfexecute name="C:\GPG\encrypt.bat" timeout="30"></cfexecute>

The cfm is residing on the E drive on the server.  The executable is residing on the C drive.  any ideas?  i'm using coldfusion 8.
0
 
_agx_Commented:
Only what I mentioned before, about it being a permissions issue.  That is the most likely cause.  Did you ask your host?  
0
 
COwebmasterAuthor Commented:
I am the host.
0
 
_agx_Commented:
So much for that idea ;-)    Other than checking the CF account permissions, I am about tapped on ideas.  Sorry :/   That is the most common problem. (ie the CF service running under an account that does not have sufficient permissions to run that executable).
0
 
COwebmasterAuthor Commented:
Thanks!
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 15
  • 15
Tackle projects and never again get stuck behind a technical roadblock.
Join Now