Using Rebex Encryption Methods:
How may I produce the same encrypted output as the following one produced by BouncyCastle:
Public Sub encryptFile(ByVal recipientCert As X509Certificate, ByVal path As String)
Dim mailBytes() As Byte = File.ReadAllBytes("C:\somedir\message.eml")
Dim keysize As Int16 = 128
Dim input As New CmsProcessableByteArray(mailBytes)
Dim generator As New CmsEnvelopedDataGenerator()
generator.AddKeyTransRecipient(DotNetUtilities.FromX509Certificate(recipientCert))
Dim encrypted As CmsEnvelopedData = generator.Generate(input, PkcsObjectIdentifiers.DesEde3Cbc.Id, keysize)
File.WriteAllBytes(path, encrypted.GetEncoded())
End Sub