SimpleJavaMail: Where is dkimPrivateKey from?

227 Views Asked by At

I am using Simple Java Mail to send emails signed with DKIM. Simple Java Mail offers this method in class

public EmailPopulatingBuilder signWithDomainKey(
     @Nonnull
     String dkimPrivateKey,
     @Nonnull
     String signingDomain,
     @Nonnull
     String dkimSelector)

I would like to know where and how to get dkimPrivateKey in the method. According to online information, I need to run something like the following (in Windows Prompt) to generate private key:

openssl genrsa -out dkim.pem 1024 (this generates a file dkim.pem)

openssl pkcs8 -topk8 -nocrypt -in dkim.pem -outform der -out dkim.der  (this generates a file dkim.der)

dkim.pem is a text file with a RSA private key. dkim.der is a binary file and so I cannot copy it directly into a Java program.

0

There are 0 best solutions below