diff --git a/openssl/src/cms.rs b/openssl/src/cms.rs index 5781a01f..d8d64c00 100644 --- a/openssl/src/cms.rs +++ b/openssl/src/cms.rs @@ -13,8 +13,8 @@ use bio::{MemBio, MemBioSlice}; use error::ErrorStack; use libc::c_uint; use pkey::{HasPrivate, PKeyRef}; -use stack::Stack; -use x509::X509; +use stack::StackRef; +use x509::{X509, X509Ref}; use {cvt, cvt_p}; bitflags! { @@ -130,13 +130,16 @@ impl CmsContentInfo { /// OpenSSL documentation at [`CMS_sign`] /// /// [`CMS_sign`]: https://www.openssl.org/docs/manmaster/man3/CMS_sign.html - pub fn sign( - signcert: Option<&X509>, + pub fn sign( + signcert: Option<&X509Ref>, pkey: Option<&PKeyRef>, - certs: Option<&Stack>, + certs: Option<&StackRef>, data: Option<&[u8]>, flags: CMSOptions, - ) -> Result { + ) -> Result + where + T: HasPrivate, + { unsafe { let signcert = signcert.map_or(ptr::null_mut(), |p| p.as_ptr()); let pkey = pkey.map_or(ptr::null_mut(), |p| p.as_ptr());