diff options
| author | Benjamin Fry <[email protected]> | 2017-03-19 00:25:45 -0700 |
|---|---|---|
| committer | Bastian Köcher <[email protected]> | 2018-03-07 13:41:44 +0100 |
| commit | eb6296e892b168ef5f0908271443b646d742d724 (patch) | |
| tree | ebed9ff08c67a670ac74387b56f41a4992bcc681 /openssl/src | |
| parent | Remove the x509 module-level example (diff) | |
| download | rust-openssl-eb6296e892b168ef5f0908271443b646d742d724.tar.xz rust-openssl-eb6296e892b168ef5f0908271443b646d742d724.zip | |
add verify_cert and store_context_builder
Diffstat (limited to 'openssl/src')
| -rw-r--r-- | openssl/src/x509/tests.rs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/openssl/src/x509/tests.rs b/openssl/src/x509/tests.rs index 6f6b430a..e91a039b 100644 --- a/openssl/src/x509/tests.rs +++ b/openssl/src/x509/tests.rs @@ -291,3 +291,20 @@ fn clone_x509() { let cert = X509::from_pem(cert).unwrap(); cert.clone(); } + +#[test] +fn test_verify_cert() { + let cert = include_bytes!("../../test/cert.pem"); + let cert = X509::from_pem(cert).unwrap(); + let ca = include_bytes!("../../test/root-ca.pem"); + let ca = X509::from_pem(ca).unwrap(); + + let mut store_bldr = X509StoreBuilder::new().unwrap(); + store_bldr.add_cert(ca); + let store = store_bldr.build(); + + let store_ctx_bldr = X509StoreContext::builder().unwrap(); + let store_ctx = store_ctx_bldr.build(store, cert, Stack::new().unwrap()).unwrap(); + + store_ctx.verify_cert().unwrap(); +} |