diff --git a/openssl/src/x509/mod.rs b/openssl/src/x509/mod.rs
index 05aec9a9c7..618a952c39 100644
--- a/openssl/src/x509/mod.rs
+++ b/openssl/src/x509/mod.rs
@@ -420,6 +420,67 @@ impl X509Ref {
}
}
+ /// Returns this certificate's extensions for the given [Nid].
+ ///
+ /// # Examples
+ ///
+ /// ```
+ /// use openssl::nid::Nid;
+ /// use openssl::x509::X509;
+ ///
+ /// let cert = X509::from_pem(include_bytes!("../../test/extensions.pem")).unwrap();
+ /// let nid = Nid::create(&"1.3.6.1.4.1.41482.5.3", &"fw", &"firmware").unwrap();
+ /// let extension = cert.get_ext_by_nid(nid).unwrap().unwrap();
+ /// let value = extension.data().as_slice();
+ /// assert_eq!(value, [4, 3, 5, 2, 7]);
+ /// ```
+ #[corresponds(X509_get_ext_by_NID)]
+ pub fn get_ext_by_nid(&self, nid: Nid) -> Result