]> git.proxmox.com Git - rustc.git/blob - vendor/security-framework/src/os/macos/certificate_oids.rs
New upstream version 1.73.0+dfsg1
[rustc.git] / vendor / security-framework / src / os / macos / certificate_oids.rs
1 //! OIDs associated with certificate properties.
2 use core_foundation::base::TCFType;
3 use core_foundation::string::CFString;
4 use core_foundation_sys::string::CFStringRef;
5 use security_framework_sys::certificate_oids::kSecOIDX509V1SignatureAlgorithm;
6
7 /// An identifier of a property of a certificate.
8 #[derive(Copy, Clone)]
9 pub struct CertificateOid(CFStringRef);
10
11 #[allow(missing_docs)]
12 impl CertificateOid {
13 #[inline(always)]
14 #[must_use]
15 pub fn x509_v1_signature_algorithm() -> Self {
16 unsafe { Self(kSecOIDX509V1SignatureAlgorithm) }
17 }
18
19 /// Returns the underlying raw pointer corresponding to this OID.
20 #[inline(always)]
21 #[must_use]
22 pub fn as_ptr(&self) -> CFStringRef {
23 self.0
24 }
25
26 /// Returns the string representation of the OID.
27 #[inline]
28 #[must_use]
29 pub fn to_str(&self) -> CFString {
30 unsafe { CFString::wrap_under_get_rule(self.0) }
31 }
32 }