-x option encryption

已查看 31 次
跳至第一个未读帖子

Stevew

未读,
2020年1月12日 10:24:052020/1/12
收件人 vim_use
is the  a way to automatically put the password in the startup command. 
E.G.

vi -x mypassword mynicefile.txt

This of course does not work. But is the a way to do something like this?

thanks.

Salman Halim

未读,
2020年1月12日 10:38:512020/1/12
收件人 Vim Users
This isn't what you asked, of course, but it seems problematic to me to have the password become part of your command-line history in plain text. Defeats one of the protections provided by the encryption.

--

Salman

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/5a69ee06-aafe-4a4d-9221-6e325bf184ec%40googlegroups.com.

Grant Taylor

未读,
2020年1月12日 11:54:172020/1/12
收件人 vim...@googlegroups.com
On 1/12/20 8:24 AM, Stevew wrote:
> is the a way to automatically put the password in the startup command.

If your goal is to open vim and work with encrypted files without the
hassle of decrypting them, there is an option.

I've installed a plugin that will automatically decrypt GPG encrypted
files on open and encrypt on write / close. It interfaces with the GPG
agent to access the keys as necessary.

Depending on how the GPG agent is configured, if the key is in memory,
you will not be prompted for any pass phrase.

> But is the a way to do something like this?

I don't know if what I described above will do what you want or not.

> thanks.

:-)



--
Grant. . . .
unix || die

Stevew

未读,
2020年1月12日 15:48:012020/1/12
收件人 vim_use
thanks for your responses.

I'm really just looking for a command line option as I mentioned. I didn't seem one and it appears there is none.

As far as being in memory or history.  I'm not that concerned. The files are not exactly the colonel's recipe.

Thanks.

Andy Wokula

未读,
2020年1月13日 12:23:262020/1/13
收件人 vim...@googlegroups.com
You can set a key with :set key=mycoolkey

This works here (doubles quotes = on Windows):



vim --cmd "set key=mycoolkey" mynicefile.txt



(needless to say this is not recommended ...)



--

Andy

Grant Taylor

未读,
2020年1月13日 13:16:202020/1/13
收件人 vim...@googlegroups.com
On 1/13/20 10:22 AM, 'Andy Wokula' via vim_use wrote:
> You can set a key with :set key=mycoolkey

Interesting.

> This works here (doubles quotes = on Windows):
>
> vim --cmd "set key=mycoolkey" mynicefile.txt

I wonder if it would be possible to play with other methods to populate
the "mycoolkey" text. Admittedly, they aren't as Windows friendly.

Environment variables are the first thing that comes to mind.

After that is file redirection, possibly from a sub-command.

Finally, a full sub-command that extracts the password out of something,
possibly GPG protected file. }:-)

> (needless to say this is not recommended ...)

I know that the typical gotchas are the output of ps (et al.) and
methods to access other processes environment variables. What other
concerns are there that my uncaffeinated brain is missing?

Tim Chase

未读,
2020年1月13日 13:45:422020/1/13
收件人 'Grant Taylor' via vim_use
On 2020-01-13 11:16, 'Grant Taylor' via vim_use wrote:
> On 1/13/20 10:22 AM, 'Andy Wokula' via vim_use wrote:
> > You can set a key with :set key=mycoolkey
>
> Interesting.
>
> > This works here (doubles quotes = on Windows):
> >
> > vim --cmd "set key=mycoolkey" mynicefile.txt
>
> I wonder if it would be possible to play with other methods to
> populate the "mycoolkey" text. Admittedly, they aren't as Windows
> friendly.
>
> Environment variables are the first thing that comes to mind.

Did a quick test:

$ vim delme.txt
[add some text]
:set key=secret
:wq
$ KEY="$(echo secret)" vim +'let &key=$KEY | e delme.txt

which lets you use any method you want to obtain the secret key
(using the super-secure "echo" method of password storage here)

Alternatively, you could obtain the key without the environment
variable, though note that the trailing newline becomes part of the
password:

$ echo secret > password.txt
$ vim delme.txt
[add some text]
:let &key=system('cat password.txt")
:wq
$ vim +'let &key=system("cat password.txt") | e delme.txt'

where you can use whatever program you want in place of

"cat password.txt"

to obtain your password.

-tim






Stevew

未读,
2020年1月14日 11:36:402020/1/14
收件人 vim_use
Hey andy that works .
Thanks. 
回复全部
回复作者
转发
0 个新帖子