2013-04-02 75 views
2

按照wiki中記錄的文檔,我試圖使用KeyczarTool來生成新的密鑰集。其他人遇到此FileNotFoundException? KeyczarTool.jar具有rwx權限,並嘗試通過sudo運行。使用KeyczarTool創建新的密鑰集

從文檔

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 

回答

0

正如@jbtule指出你必須先創建密鑰目錄。但也包括。在斜線之前。

正確工作的命令是: $ Java的罐子KeyczarTool-0.71f-060112.jar創建--location = ./keys --purpose =隱窩-name = 「第一重點」 --asymmetric = RSA

+1

好,或者只是'--location = keys' – jbtule