protected function messageStreamToSignedByteStream(Swift_FileStream $outputStream, Swift_InputByteStream $inputStream)
{
$signedMessageStream = new Swift_ByteStream_TemporaryFileByteStream();
$args = array($outputStream->getPath(), $signedMessageStream->getPath(), $this->signCertificate, $this->signPrivateKey, array(), $this->signOptions);
if (null !== $this->extraCerts) {
$args[] = $this->extraCerts;
}
if (!call_user_func_array('openssl_pkcs7_sign', $args)) {
throw new Swift_IoException(sprintf('Failed to sign S/Mime message. Error: "%s".', openssl_error_string()));
}
$this->copyFromOpenSSLOutput($signedMessageStream, $inputStream);
}