在bash脚本中使用pinentry-tty(如read) [英] using pinentry-tty in a bash script (like read)

查看:57
本文介绍了在bash脚本中使用pinentry-tty(如read)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有一种方法可以直接在bashscript中使用pinentry-tty?例如.作为阅读"的更安全替代.我在想这样的事情:

Is there a way to use pinentry-tty directly in a bashscript? E.G. as a more secure replacement for 'read'. I was thinking of something like this:

local pass=$(pinentry-tty);

这使我可以输入几行,但是什么也没有保存到变量中.

This allows me to enter several lines, but nothing gets saved to the variable.

推荐答案

不同的 pinentry 实现无法轻松地以您想使用的方式来调用.它遵循一个简单的协议,这也使配置提示和打印错误消息的多种可能性成为可能.一个示例会话,其中 GETPIN 是在 STDIN 上发出的命令,而 foo 是用户输入的密码,并在上返回了其他状态消息> STDOUT :

The different pinentry implementations cannot easily be called the way you wanted to use it. It follows a simple protocol, which also enables several possibilities to configure prompts and print error messages. An example session, with GETPIN being the command issued on STDIN and foo being the passphrase the user entered, returned with other status messages on STDOUT:

$ pinentry
OK Pleased to meet you
GETPIN
D foo
OK

完整文档包含在 pinentry的源压缩包中,但也可以在线获得.

这篇关于在bash脚本中使用pinentry-tty(如read)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆