Re: [Javamail-crypto-devel] How do I create a pkr file?
Status: Beta
Brought to you by:
akp
|
From: allen p. <al...@su...> - 2007-05-25 15:22:02
|
Hi.
The javamail-crypto library is, at least for now, just a high-level API for
handling encryption and signing of emails. While it does have some
key-management features, it is not meant to be a general-purpose encryption
API.
That having been said, in the case of PGP, I use gnupg to manage my PGP
keys. You can use the gnupg pubring.gpg as the public keystore for
javamail-crypto.
If you have a public keyring created, and someone sends you an email
containing their PGP public key, you can use javamail-crypto to import said
key into your public keystore. It goes something like
EncryptionUtils utils = EncryptionManager.getEncryptionUtils(message);
Key[] extractedKeys = utils.extractKeys(message);
for (int i = 0; i < extractedKeys.length; i++) {
net.suberic.crypto.EncryptionKey eKey =
(net.suberic.crypto.EncryptionKey) extractedKeys[i];
publicKeyStore.setPublicKeyEntry(eKey.getDisplayAlias(), eKey);
}
I don't have a way to load the keys just from straight text files. You can
either use external tools, or you could just use the Cryptix or
BouncyCastle APIs directly for that.
I get the feeling that that would be a good feature to add into the API.
-allen
On Tue, May 22, 2007, 15:21, Warren Goldman
<War...@so...> wrote
>The example shows (at http://javamail-crypto.sourceforge.net/);
>
>
>
> pgpKeyMgr.loadPublicKeystore(new FileInputStream(new
File("./alice.pkr")), null);
>
>
>
>How do I create the alice.pkr or where is documentation that tells me how?
>
>
>
>I need to encrypt a message (using someone elses public key). I do not
need to decrypt. So I am assuming my pkr would only need an entry
>
>for that persons public key
>
>
>
>Furthermore, how do I get the other person's public key into my pkr so
that I may encrypt the message?
>
>
>
>The following link talks about it, but it looks like I need some client
side app (pgp) to import the public key.
>
>http://www.ephesus.com/Encryption/RetrieveKeys.html
>
>
>
>Help is appreciated.
>
>
|