Get Private & Public Key For Encryption and Decryp

2019-07-16 16:10发布

问题:

I know id file contains Private and Public Key. Public Key is inside Certificate under Id File and Private Key is inside id file but not in the certificate. The Question is how can i get those keys through my java code . I need to encrypt and decrypt mails .

回答1:

Public keys can be found in the Domino Directory. You don't need to do anything special to encrypt emails. The Notes APIs will do that for you automatically.

Decryption is another story. The whole point of a private key is that it is private. The private key in your current ID file is available to you after you type in your password, but you can't access any other private key. Private keys are encrypted using a password-derived key and if there was any way to get around that encryption, it would not be private!

So, if you are trying to decrypt messages sent to users, the only way to do that is to switch the current ID to that user's ID file, using that user's password.



回答2:

Easiest way is to create a shared certificate across all users and add that to your Java code.

The following sample shows you how to create a self-signed certificate.

http://www-10.lotus.com/ldd/ddwiki.nsf/dx/Connecting_to_a_Domino_server_over_SSL_in_Java_using_a_self_signed_certificate._