I am using Keyczar and this is the psedo code on the website

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

I know its the path to my encrpytion key but what type of file is it ??

What type of file are they refering to for "/path/to/your/keys". ???

It will be good if I can have a sample of such a file

有帮助吗?

解决方案

You have to create keys of your own. Simply follow the tutorial from the projects home page:

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

Then you can refer to the key in your code:

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

If you already have some private key (X.509), you can import it.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top