按照wiki中指出的文档,我试图使用KeyczarTool来生成新的密钥集。还有人遇到过FileNotFoundException吗?KeyczarTool.jar具有rwx权限,并尝试通过sudo运行。
从文档Command Usage:
create --location=/path/to/keys --purpose=(crypt|sign) [--name="A name"] [--asymmetric=(dsa|rsa|ec)]
Creates a new, empty key set in the given location.
This key set must have a purpose of either "crypt" or "sign"
and may optionally be given a name. The optional version
flag will generate a public key set of the given algorithm.
The "dsa" and "ec" asymmetric values are valid only for sets
with "sign" purpose.
Cmd:
$ java -jar KeyczarTool-0.71f-060112.jar create --location=/keys --purpose=crypt -name="first key" --asymmetric=rsa
输出:org.keyczar.exceptions.KeyczarException: Unable to write to: /keys/meta
at org.keyczar.KeyczarTool.create(KeyczarTool.java:366)
at org.keyczar.KeyczarTool.main(KeyczarTool.java:123)
Caused by: java.io.FileNotFoundException: /keys/meta (No such file or directory)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(FileOutputStream.java:194)
at java.io.FileOutputStream.<init>(FileOutputStream.java:145)
at org.keyczar.KeyczarTool.create(KeyczarTool.java:362)
... 1 more
对于当前版本的java keyczar,需要在运行程序之前先创建目录"keys"。
这是一个已知问题KeyczarTool应该自动创建目录。
正如@jbtule好心指出的,您必须首先创建键dir。但也包括。斜杠之前。
正确的工作命令是:$ java -jar KeyczarTool-0.71f-060112.jar创建——location=。/keys——purpose=crypt -name="first key"——asymmetric=rsa