diff options
| author | Ansley Peduru <[email protected]> | 2017-12-31 22:39:28 -0500 |
|---|---|---|
| committer | Ansley Peduru <[email protected]> | 2017-12-31 22:39:28 -0500 |
| commit | 1a40795886e649dc429b7487323f2873783ca092 (patch) | |
| tree | 970e9124f46ec6820393c8fe3c4af895050afb37 /openssl/src/verify.rs | |
| parent | Merge pull request #810 from sfackler/key-tag (diff) | |
| download | rust-openssl-1a40795886e649dc429b7487323f2873783ca092.tar.xz rust-openssl-1a40795886e649dc429b7487323f2873783ca092.zip | |
Add documentation for x509 module
Diffstat (limited to 'openssl/src/verify.rs')
| -rw-r--r-- | openssl/src/verify.rs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/openssl/src/verify.rs b/openssl/src/verify.rs index 4074c216..866f4f14 100644 --- a/openssl/src/verify.rs +++ b/openssl/src/verify.rs @@ -7,6 +7,7 @@ use cvt; use error::ErrorStack; bitflags! { + /// Flags used to check an `X509` certificate. pub struct X509CheckFlags: c_uint { const ALWAYS_CHECK_SUBJECT = ffi::X509_CHECK_FLAG_ALWAYS_CHECK_SUBJECT; const FLAG_NO_WILDCARDS = ffi::X509_CHECK_FLAG_NO_WILDCARDS; @@ -24,17 +25,29 @@ foreign_type_and_impl_send_sync! { type CType = ffi::X509_VERIFY_PARAM; fn drop = ffi::X509_VERIFY_PARAM_free; + /// Adjust parameters associated with certificate verification. pub struct X509VerifyParam; + /// Reference to `X509VerifyParam`. pub struct X509VerifyParamRef; } impl X509VerifyParamRef { + /// Set the host flags. + /// + /// This corresponds to [`X509_VERIFY_PARAM_set_hostflags`]. + /// + /// [`X509_VERIFY_PARAM_set_hostflags`]: https://www.openssl.org/docs/man1.1.0/crypto/X509_VERIFY_PARAM_set_hostflags.html pub fn set_hostflags(&mut self, hostflags: X509CheckFlags) { unsafe { ffi::X509_VERIFY_PARAM_set_hostflags(self.as_ptr(), hostflags.bits); } } + /// Set the expected DNS hostname. + /// + /// This corresponds to [`X509_VERIFY_PARAM_set1_host`]. + /// + /// [`X509_VERIFY_PARAM_set1_host`]: https://www.openssl.org/docs/man1.1.0/crypto/X509_VERIFY_PARAM_set1_host.html pub fn set_host(&mut self, host: &str) -> Result<(), ErrorStack> { unsafe { cvt(ffi::X509_VERIFY_PARAM_set1_host( @@ -45,6 +58,11 @@ impl X509VerifyParamRef { } } + /// Set the expected IPv4 or IPv6 address. + /// + /// This corresponds to [`X509_VERIFY_PARAM_set1_ip`]. + /// + /// [`X509_VERIFY_PARAM_set1_ip`]: https://www.openssl.org/docs/man1.1.0/crypto/X509_VERIFY_PARAM_set1_ip.htm://www.openssl.org/docs/man1.1.0/crypto/X509_VERIFY_PARAM_set1_ip.html pub fn set_ip(&mut self, ip: IpAddr) -> Result<(), ErrorStack> { unsafe { let mut buf = [0; 16]; |