急!简单问题,帮忙看下

绿旅嗒 2016-05-04 10:46:12
要执行的脚本:
#! /bin/bash
gpg --recipient 025674861 --output test1.txt.gpg --encrypt test1.txt
if [ -f "test1.txt.gpg" ]; then
echo "test1.txt.gpg"
fi

执行后:
[user@webss shell]$ ./gpgEncryptFil
gpg: 51538612BA: There is no assurance this key belongs to the named user

pub 5168G/51538612BA 2016-04-21 XXX
Primary key fingerprint: XXXXX
Subkey fingerprint: XXXX

It is NOT certain that the key belongs to the person named
in the user ID. If you *really* know what you are doing,
you may answer the next question with yes.

Use this key anyway? (y/N)

怎样让脚本自动选择“y”,不用手动选。我需要java调用。
因需要选择,java调用脚本,不能正常执行。




...全文
173 1 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
绿旅嗒 2016-05-04
  • 打赏
  • 举报
回复
CSDN不行了,发帖没人回! 自己解决了。GPG公钥需要设置信任 作者:陈俊儒 链接:https://www.zhihu.com/question/19987578/answer/13586551 来源:知乎 著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。 只要将证书设置为可信就好了, --no-tty 是参数是不在控制台输出数据,去掉的话也能看到问题 ~~ gpg 需设置key为可信,不然每次都会提示"Use this key anyway? (y/N)" 命令: gpg --edit-key Todaynic 然后参照: When importing a public key onto another machine, you may have configure gpg to trust the key. Otherwise, when you use the key to do encryption, you may see a prompt like this: It is NOT certain that the key belongs to the person named in the user ID. If you *really* know what you are doing, you may answer the next question with yes. Use this key anyway? (y/N) To trust the key, run: gpg --edit-key NAME gpg will output some information, and show a line like: trust: undefined validity: unknown You will be at a console, and you have to type "trust": Command> trust Please decide how far you trust this user to correctly verify other users' keys (by looking at passports, checking fingerprints from different sources, etc.) 1 = I don't know or won't say 2 = I do NOT trust 3 = I trust marginally 4 = I trust fully 5 = I trust ultimately m = back to the main menu Your decision? 5 Do you really want to set this key to ultimate trust? (y/N) y Type "quit" to quit. If you run gpg --edit-key NAME again, you will see a line as below, which means the key is now trusted. trust: ultimate validity: ultimate

18,829

社区成员

发帖
与我相关
我的任务
社区描述
Linux/Unix社区 专题技术讨论区
社区管理员
  • 专题技术讨论区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧