0

我正在使用Keyczar,这是网站上的伪代码

 Crypter crypter = new Crypter("/path/to/your/keys");
 String ciphertext = crypter.encrypt("Secret message");

我知道它是我的加密密钥的路径,但它是什么类型的文件?

他们指的是什么类型的文件"/path/to/your/keys"。???

如果我能有这样一个文件的样本就好了

4

1 回答 1

3

您必须创建自己的密钥。只需按照项目主页上的教程进行操作:

mkdir -p /tmp/keys
keyczart create --location=/tmp/keys --purpose=crypt
keyczart addkey --location=/tmp/keys --status=primary

然后您可以参考代码中的密钥:

Crypter crypter = new Crypter("/tmp/keys");
String ciphertext = crypter.encrypt("Secret message");

如果您已经有一些私钥(X.509),您可以导入它。

于 2014-05-02T06:49:56.887 回答