Skip to content

Commit 442a4c1

Browse files
author
enri1196
committed
cms get_type
1 parent a644ec2 commit 442a4c1

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

openssl-sys/src/handwritten/cms.rs

+2
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,6 @@ extern "C" {
6262
out: *mut BIO,
6363
flags: c_uint,
6464
) -> c_int;
65+
66+
pub fn CMS_get0_type(cms: *const CMS_ContentInfo) -> *const ASN1_OBJECT;
6567
}

openssl/src/cms.rs

+10
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,13 @@ use foreign_types::{ForeignType, ForeignTypeRef};
1010
use libc::c_uint;
1111
use std::ptr;
1212

13+
use crate::asn1::Asn1ObjectRef;
1314
use crate::bio::{MemBio, MemBioSlice};
1415
use crate::error::ErrorStack;
1516
use crate::pkey::{HasPrivate, PKeyRef};
1617
use crate::stack::StackRef;
1718
use crate::symm::Cipher;
19+
use crate::util::ForeignTypeRefExt;
1820
use crate::x509::{store::X509StoreRef, X509Ref, X509};
1921
use crate::{cvt, cvt_p};
2022
use openssl_macros::corresponds;
@@ -275,6 +277,14 @@ impl CmsContentInfo {
275277
Ok(())
276278
}
277279
}
280+
281+
#[corresponds(CMS_get0_type)]
282+
pub fn get_type(&self) -> &Asn1ObjectRef {
283+
unsafe {
284+
let asn1_type = ffi::CMS_get0_type(self.as_ptr() as *const _);
285+
&Asn1ObjectRef::from_const_ptr(asn1_type)
286+
}
287+
}
278288
}
279289

280290
#[cfg(test)]

0 commit comments

Comments
 (0)