Add `CmsContentInfo` <-> PEM bindings
This commit is contained in:
parent
3629bb6f26
commit
124c05d058
|
|
@ -146,6 +146,14 @@ extern "C" {
|
|||
) -> *mut PKCS7;
|
||||
|
||||
pub fn PEM_write_bio_PKCS7(bp: *mut BIO, x: *mut PKCS7) -> c_int;
|
||||
|
||||
pub fn PEM_read_bio_CMS(
|
||||
bio: *mut BIO,
|
||||
out: *mut *mut CMS_ContentInfo,
|
||||
callback: pem_password_cb,
|
||||
user_data: *mut c_void,
|
||||
) -> *mut CMS_ContentInfo;
|
||||
pub fn PEM_write_bio_CMS(bio: *mut BIO, cms: *const CMS_ContentInfo) -> c_int;
|
||||
}
|
||||
|
||||
pub const PEM_R_NO_START_LINE: c_int = 108;
|
||||
|
|
|
|||
|
|
@ -105,6 +105,16 @@ impl CmsContentInfoRef {
|
|||
to_der,
|
||||
ffi::i2d_CMS_ContentInfo
|
||||
}
|
||||
|
||||
to_pem! {
|
||||
/// Serializes this CmsContentInfo using DER.
|
||||
///
|
||||
/// OpenSSL documentation at [`PEM_write_bio_CMS`]
|
||||
///
|
||||
/// [`PEM_write_bio_CMS`]: https://www.openssl.org/docs/man1.1.0/man3/PEM_write_bio_CMS.html
|
||||
to_pem,
|
||||
ffi::PEM_write_bio_CMS
|
||||
}
|
||||
}
|
||||
|
||||
impl CmsContentInfo {
|
||||
|
|
@ -134,6 +144,17 @@ impl CmsContentInfo {
|
|||
ffi::d2i_CMS_ContentInfo
|
||||
}
|
||||
|
||||
from_pem! {
|
||||
/// Deserializes a PEM-encoded ContentInfo structure.
|
||||
///
|
||||
/// This corresponds to [`PEM_read_bio_CMS`].
|
||||
///
|
||||
/// [`PEM_read_bio_CMS`]: https://www.openssl.org/docs/man1.1.0/man3/PEM_read_bio_CMS.html
|
||||
from_pem,
|
||||
CmsContentInfo,
|
||||
ffi::PEM_read_bio_CMS
|
||||
}
|
||||
|
||||
/// Given a signing cert `signcert`, private key `pkey`, a certificate stack `certs`,
|
||||
/// data `data` and flags `flags`, create a CmsContentInfo struct.
|
||||
///
|
||||
|
|
|
|||
Loading…
Reference in New Issue