Can't reproduce openssl command with BouncyCastle

Augustin Julien <ajn-yPf3yuYk/[email protected]> Wed, 16 Jan 2019 12:45:01 +0100 (CET)
Newsgroups gmane.comp.encryption.bouncy-castle.devel
Message-ID <[email protected]>
-------------------------------------------------------------- 
From: Augustin Julien < ajn-yPf3yuYk/[email protected] > 
To: [email protected] 
Subject: Can't reproduce openssl command with BouncyCastle 

I am trying, for already a couple of weeks to reproduce some openssl commands using bouncycastle and java. 

After following a lot of samples and trying a lot of examples from Stackoverflow, I still can't make it work, thats why I'm asking for help now. 

The openssl commands I have to reproduce are : 

openssl smime -sign -in fileToSign.eml -out signedFile.step2 -passin pass:« password» -binary -nodetach -signer myprivatecert.pem -certfile mypubliccert.pem 

This first commands takes 3 files, the file to sign, a private certificate and a public certificate. 

For more informations, you can check out this link : [ https://stackoverflow.com/questions/54200397/cant-reproduce-openssl-command-with-bouncycastle | https://stackoverflow.com/questions/54200397/cant-reproduce-openssl-command-with-bouncycastle ] 

Does anyone knows how can I get the good results using bouncy castle ? 
--------------------------------------------------------------