I have successfully generated a root certificate, by this commandline under windows
openssl req -config openssl.conf -new -x509 -days 1001 -key keys/ca.key -out certs/ca.cer
My question to you is the following:
How can I generate certificates from this root certificate in java, and sign mails with this certificate? I am currently using the JavaMail library.
You need the Java Crypto API and a crypto provider.
This is a well-known Java crypto provider: http://www.bouncycastle.org/java.html
There are classes for generating and handling X509 certificates and signing content.
Here are several examples for creating signed e-mails with BouncyCastle.
http://www.docjar.org/docs/api/org/bouncycastle/mail/smime/examples/package-index.html
This example also generates keys/certificates:
http://www.docjar.org/html/api/org/bouncycastle/mail/smime/examples/CreateSignedMultipartMail.java.html
Good luck!