I'd like to write a Domino servlet that will stamp outgoing mail with a DKIM domain keys signature. We would generate the Domino mail server DKIM signature and put it in a TXT file with the DNS manager. How can I stamp an outgoing message with the encryption key? We would then add the DKIM signature to the header prior to releasing from mail.box.
Although requested by many, HTC Domino doesn't yet support DKIM nor DMARC. Implementing DKIM on Domino might not be as easy as writing a little servlet, as it involves canonicalization, computing hashes and signing them. After that, you'd have to add a signature header that has a strict format.
Although it's all documented in the RFC 6376, many things can go wrong. Therefore, I wouldn't recommend trying to write an own implementation for DKIM signing. On the other hand, if you did that and got it working, there's indeed a huge demand for this feature! Frankly, because you are asking this question on such an abstract level, you aren't quite there yet.
A more suitable solution might be setting up another SMTP server in front of the Domino server and configuring it to trust & DKIM stamp mail from Domino. There are e.g. many tutorials on how to achieve this with Postfix & OpenDKIM.