summaryrefslogtreecommitdiff
path: root/openssl/src/x509/mod.rs
diff options
context:
space:
mode:
authorSteven Fackler <sfackler@palantir.com>2018-03-28 20:41:02 +0200
committerSteven Fackler <sfackler@palantir.com>2018-03-28 20:41:28 +0200
commit7890672725f9bd2d861170039cd07bc278616b7a (patch)
treee88b547a8bcb8b428ddb5adb81d8d37073403a71 /openssl/src/x509/mod.rs
parent812d7a613fd9025d55e876995d1c91fc4b6e25bd (diff)
downloadrust-openssl-7890672725f9bd2d861170039cd07bc278616b7a.zip
Add X509Ref::serial_number
Diffstat (limited to 'openssl/src/x509/mod.rs')
-rw-r--r--openssl/src/x509/mod.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/openssl/src/x509/mod.rs b/openssl/src/x509/mod.rs
index d4714f88..011a2d96 100644
--- a/openssl/src/x509/mod.rs
+++ b/openssl/src/x509/mod.rs
@@ -523,6 +523,19 @@ impl X509Ref {
}
}
+ /// Returns this certificate's serial number.
+ ///
+ /// This corresponds to [`X509_get_serialNumber`].
+ ///
+ /// [`X509_get_serialNumber`]: https://www.openssl.org/docs/man1.1.0/crypto/X509_get_serialNumber.html
+ pub fn serial_number(&self) -> &Asn1IntegerRef {
+ unsafe {
+ let r = ffi::X509_get_serialNumber(self.as_ptr());
+ assert!(!r.is_null());
+ Asn1IntegerRef::from_ptr(r)
+ }
+ }
+
to_pem! {
/// Serializes the certificate into a PEM-encoded X509 structure.
///