AnsweredAssumed Answered

Adding cryption (GPG) workflow

Question asked by pnnerveza on Dec 21, 2006
Latest reply on Dec 21, 2006 by kevinr
Hi there,

Help please. I'm trying to include a workflow of running a java script that will decrypt a file using GPG. My code is as follows;

[size=75]// find the backup folder - create if not already exists
var backupFolder = space.childByNamePath("Backup");
if (backupFolder == null && space.hasPermission("CreateChildren"))
{
   // create the folder for the first time
   backupFolder = space.createFolder("Backup");
}
if (backupFolder != null && backupFolder.hasPermission("CreateChildren"))
{
   // copy the doc into the backup folder
   var copy = document.copy(backupFolder);
   if (copy != null)
   {
      // change the name so we know it's a backup
      //copy.name = "Backup of " + copy.name;
      //copy.save();[/size]
      //set the variable for decryption   
path = copy.name;
cmd="gpg –no-secmem-warning –passphrase-fd 0 –batch –decrypt  "
      //execute decryption
Runtime.getRuntime().exec(cmd + path);
   }
}


The script was saved at "Script" space. Then i added a "run a script" using the script above in one of my spaces. But when i uploaded a file to the space, i encountered the error below;


A system error happened during the operation: Transaction didn't commit: Failed to execute script 'workspace://SpacesStore/e3198187-90a3-11db-ac28-f9382764acb5': ReferenceError: "Runtime" is not defined. (AlfrescoScript#20)


Will someone help me on this.

Thanks

Outcomes