Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #20206
    Stefan
    Participant

    Hi Yutaka,

    please consider to implement a AES encryption feature.
     
    File > Save As Encrypted… >>> Enter password > Re-enter passwort
     
    If a encrypted file is loaded (or, maybe, on special file extension? Like *.EEE), prompt to enter the password/phrase.
     
     
    Thanks for making EmEditor.

     
     *.EEE — EmEditor Encryption

    File Extension EEE
    .EEE File
    File extension: EEE
    File type: Encrypted File
    The EEE file type is primarily associated with ‘3eee Triple Encryption’ by Fasttrack Ltd..

    #20215
    Stefan
    Participant

    Something like this I had in mind:

    Encrypt-Encryption.jsee v0.01

    
    //Encrypt-Encryption.jsee v0.01 - EmEditor 15 - 2015-06-26 by Stefan
    WshFSO = new ActiveXObject( "Scripting.FileSystemObject" );
    strFullName = document.FullName;
    	if(strFullName==""){
    		alert("Sorry, we don't work on non-existent document.\nPlease save it first.\n\nScript quits here.");
    		quit();
    	}
    	if (!document.Saved){
    		alert("Sorry, we don't work on un-saved document.\nPlease save it first.\n\nScript quits here.");
    		quit();
    	}
    	strPath     = fPathName(document.FullName);
    	strName     = document.Name;
    	strBase     = fBaseName(strName);
    	strExte     = fNameExte(strName);
    	strPaBa     = strPath+"\\"+strBase;
    	strNewName  = strPath+ "\\" + strBase + "_Backup." + strExte;
    	strEEFolder = fPathName(editor.FullName);
    
    	if(strExte=="EEE")
    	{
    		vUserAnswer = confirm("*.EEE file detected. Already encrypted? Encrypt it again?");
    		if(!vUserAnswer) quit();
    	}
    
    	strEncryptionName =  strFullName + ".EEE";
    	strEncryptionName = prompt("Save encrypted file as:", strEncryptionName);
    	if(!strEncryptionName) quit();
    	if(WshFSO.FileExists(strEncryptionName))
    	{
    		vUserAnswer = confirm("Already existend. Overwrite?\n\n"+strEncryptionName);
    		if(!vUserAnswer) quit();
    	}
    
    	/*
    	Need thirs-party utility:
    	MySecret Blowfish Encryption Utility - Version 3.1.1 Released 9 June 2007.
    	Freeware command-line encryption utility - http://www.di-mgt.com.au/mysecret.html
    	Copyright (C) 2002-7 DI Management Services Pty Limited ABN 78 083 210 584 
    	Sydney, Australia. www.di-mgt.com.au. All rights reserved.
    	*/
    
    	//MySecret -e -p "my pass phrase" -i infile -o outfile //-e|-d force Encrypt/Decrypt
    	pwd = prompt("Pass phrase to encrypt:","");
    	if(!pwd) quit();
    	
    	cmd = strEEFolder + "\\Tools\\MySecret.exe -e -p " + pwd;
    	cmd = cmd + " -i " + strFullName + " -o " + strEncryptionName;
    	WshShell = new ActiveXObject( "WScript.Shell" );
    	WshShell.Run(cmd);
    
    	sleep(500);
    	if(WshFSO.FileExists(strEncryptionName))	{
    		editor.NewFile();
    		//document.close(); //close current plain file
    		editor.OpenFile( strEncryptionName );
    	}else{alert("Error. "+strEncryptionName+" not found." );}
    	
    //--------------------------------
    function fPathName(str)
    {
        if(str.lastIndexOf("\\") != -1)       
           path = str.substring(0, str.lastIndexOf("\\"));
       return path;
    }
    function fBaseName(str)
    {
        if(str.lastIndexOf(".") != -1)       
           base = str.substring(0, str.lastIndexOf("."));
       return base;
    }
    function fNameExte(str)
    {
        if(str.lastIndexOf(".") != -1)       
           exten = str.substring(str.lastIndexOf(".")+1);
       return exten;
    }
    

     

    #20216
    Stefan
    Participant

    Encrypt-DEcryption.jsee v0.01 – EmEditor 15 – 2015-06-26 by Stefan

    
    //Encrypt-DEcryption.jsee v0.01 - EmEditor 15 - 2015-06-26 by Stefan
    WshFSO = new ActiveXObject( "Scripting.FileSystemObject" );
    strFullName = document.FullName;
    	if(strFullName==""){
    		alert("Sorry, we don't work on non-existent document. Please save it first.\n\nScript quits here.");
    		quit();
    	}
    	strPath     = fPathName(document.FullName);
    	strName     = document.Name;
    	strBase     = fBaseName(strName);
    	strExte     = fNameExte(strName);
    	strPaBa     = strPath+"\\"+strBase;
    	strNewName  = strPath+ "\\" + strBase + "_Backup." + strExte;
    	strEEFolder = fPathName(editor.FullName);
    	
    	strDecryptedName =  strPaBa; 
    	
    	if(strExte != "EEE") {
    		vUserAnswer = confirm("Seems not to be an encrypted file,\nor at least no EEE Extension?\n\nStill continue?");
    		if(!vUserAnswer) quit();
    	}
    
    		if (!document.Saved){
    			alert("Sorry, we don't work on un-saved document.\nPlease save it first.\n\nScript quits here.");
    			quit();
    		}
    
    		strDecryptedName = prompt("Save decrypted file as:", strDecryptedName);
    		if(WshFSO.FileExists(strDecryptedName))
    		{
    			vUserAnswer = confirm("Already existend. Overwrite?\n\n"+strDecryptedName);
    			if(!vUserAnswer) quit();
    		}
    
    		/*
    		Need thirs-party utility:
    		MySecret Blowfish Encryption Utility - Version 3.1.1 Released 9 June 2007.
    		Freeware command-line encryption utility - http://www.di-mgt.com.au/mysecret.html
    		Copyright (C) 2002-7 DI Management Services Pty Limited ABN 78 083 210 584 
    		Sydney, Australia. www.di-mgt.com.au. All rights reserved.
    		*/
    
    		//MySecret -d -p "my pass phrase" -i infile -o outfile //-e|-d force Encrypt/Decrypt
    		pwd = prompt("Pass phrase to decrypt:","");
    		if(!pwd) quit();
    		
    		cmd = strEEFolder + "\\Tools\\MySecret.exe -d -p " + pwd;
    		cmd = cmd + " -i " + strFullName + " -o " + strDecryptedName;
    		WshShell = new ActiveXObject( "WScript.Shell" );
    		WshShell.Run(cmd);
    
    		sleep(500);
    		if(WshFSO.FileExists(strDecryptedName))
    		{
    			editor.NewFile();
    			//document.close(); //close current encrypted file
    			editor.OpenFile(strDecryptedName);
    		}else{alert("Error. "+strDecryptedName+" not found." );}
    
    //--------------------------------
    function fPathName(str)
    {
        if(str.lastIndexOf("\\") != -1)       
           path = str.substring(0, str.lastIndexOf("\\"));
       return path;
    }
    function fBaseName(str)
    {
        if(str.lastIndexOf(".") != -1)       
           base = str.substring(0, str.lastIndexOf("."));
       return base;
    }
    function fNameExte(str)
    {
        if(str.lastIndexOf(".") != -1)       
           exten = str.substring(str.lastIndexOf(".")+1);
       return exten;
    }
    

     

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.