Commit Graph

181 Commits

Author SHA1 Message Date
Steven Fackler 4ee7e0d3a9 Tweak verify_cert's signature
The call can fail either due to an invalid cert or an internal error,
and we should distinguish between the two.
2018-03-11 14:08:34 -07:00
Bastian Köcher d7a7c379a8 Changes `init` to take a closure which is called with the initialized context
After calling the closure, we automatically cleanup the context. This is
required, because otherwise we could have dangling references in the context.
2018-03-11 11:34:36 +01:00
Bastian Köcher a5d7f8a718 Moves store context init into its own function 2018-03-10 00:15:03 +01:00
Bastian Köcher 810ddeb4ca Moves `cleanup` into its own function 2018-03-08 12:08:39 +01:00
Bastian Köcher 888f4ccaab Fixes the implementation of `X509StoreContextRef::verify_cert`
The certificate, the store and the certificates chain does not need to be
consumed by `verify_cert` and instead are taken as references. We also call
`X509_STORE_CTX_cleanup`, after the verification succeeded.
2018-03-07 16:07:57 +01:00
Benjamin Fry 53adf0e6a4 delay return until after forgets 2018-03-07 13:54:35 +01:00
Benjamin Fry 6abac82f13 cleanup and add negative test 2018-03-07 13:54:35 +01:00
Benjamin Fry a1cfde765a add cleanup ffi to store context 2018-03-07 13:54:15 +01:00
Benjamin Fry 3187366cc5 restructure to self contained function 2018-03-07 13:53:29 +01:00
Steven Fackler 2251a6f2b6 Little tweaks 2018-03-07 13:51:58 +01:00
Benjamin Fry d8a11973e2 convert to raw pass-through methods 2018-03-07 13:51:58 +01:00
Benjamin Fry 910386027d add comment about consuming self in verify_cert 2018-03-07 13:50:12 +01:00
Benjamin Fry 35cad33d51 fix error check 2018-03-07 13:50:12 +01:00
Benjamin Fry 847fac25f8 properly version library functions 2018-03-07 13:48:09 +01:00
Steven Fackler f645165ee2 Remove the x509 module-level example
The example generated a bogus certificate that was missing a serial
number, a validity range, etc.

Generating a correct x509 certificate is complex enough that doing it
correctly is too long to be a reasonable doc example. There's already
a more complete example in the examples directory that handles things
more correctly.

Closes #859
2018-03-05 19:25:01 -08:00
Steven Fackler f4ddd66b03 Tweak features
We should keep the version features totally separate for now.
2018-02-14 22:11:24 -08:00
Ian P. Cooke 60337266ab add support for rfc822Name (email) and uniformResourceIdentifier (uri) to GeneralName 2018-01-15 11:22:29 -06:00
Steven Fackler 3c19702299 Rename key serialization/deserialization methods
Also document their specific formats.

Closes #502
2018-01-06 13:27:44 -08:00
Ansley Peduru c4620a30c6 Fix links in x509 module 2018-01-01 16:16:41 -05:00
Ansley Peduru c2430b87f7
Merge branch 'master' into x509-docs 2018-01-01 15:40:02 -05:00
Steven Fackler 9043cf9aa7 Move X509Filetype to SslFiletype
These constants have the same values, but X509_FILETYPE_DEFAULT doesn't
work in the Ssl methods and using the SSL_* names is a bit less
confusing.
2018-01-01 11:50:07 -08:00
Ansley Peduru a4c9dd4af3 Fix x509 doc examples 2018-01-01 11:48:55 -05:00
Ansley Peduru 1a40795886 Add documentation for x509 module 2017-12-31 22:39:28 -05:00
Steven Fackler d207897458 Parameterize keys over what they contain
Closes #790
2017-12-30 21:53:39 -08:00
Steven Fackler 89dd50b3ce Add issuer name access.
Closes #808
2017-12-29 10:50:49 -08:00
Steven Fackler f9866cd44f Split X509StoreContextRef::ssl up 2017-12-26 14:53:35 -07:00
Steven Fackler 129b6b9d84 Overhaul verify error type
Also set the error in the hostname verification callback for 1.0.1
2017-12-26 14:43:10 -07:00
Steven Fackler 2adf2cf12b Remove deprecated APIs 2017-12-25 22:09:27 -07:00
Steven Fackler 77448362ce Rename X509FileType to X509Filetype 2017-12-25 19:57:02 -07:00
Steven Fackler 3eab162dc2 Move to associated consts 2017-12-25 19:56:27 -07:00
Steven Fackler 2aaba8bd7a Make Nid values associated constants 2017-12-25 19:19:47 -07:00
Steven Fackler 43753698da
Impl Send + Sync for x509 stuff 2017-12-13 11:35:04 -05:00
Steven Fackler e9ad9f1afd Upgrade foreign-types
foreign-types 0.3 and 0.2 now share the same types and traits, so this
is backwards compatible.
2017-11-26 17:07:24 -07:00
Steven Fackler de987f20c8
Revert "Update foreign-types to 0.3" 2017-11-21 08:51:37 -08:00
Anthony Ramine 93be1c4f2f Update foreign-types to 0.3 2017-11-21 09:17:39 +01:00
johnthagen b5bb8de4f2 Convert try! usage to ? 2017-10-03 17:44:02 -04:00
Steven Fackler 7de1499c65 Fix X509::clone impl
Closes #667
2017-07-19 19:23:47 -07:00
Steven Fackler bcd0dcafcb Rustfmt 2017-07-15 21:46:11 -07:00
Steven Fackler fd52bbe85c Add an API to install extra data 2017-07-15 16:50:36 -07:00
Benjamin Fry b431896057 mention the common fields 2017-02-22 22:05:39 -08:00
Benjamin Fry 9b24698aee some helpful documentation and example. 2017-02-20 14:48:49 -08:00
Steven Fackler 129a3cff08 Update deprecation version 2017-02-11 10:27:09 -08:00
Steven Fackler 16d5632983 Remove X509Req setters 2017-02-11 10:14:16 -08:00
Steven Fackler f2c69ae7e9 Merge remote-tracking branch 'origin/master' into x509-builder 2017-02-11 10:13:00 -08:00
Steven Fackler 5ad4af70ae Re-add reexport 2017-02-11 09:17:39 -08:00
Steven Fackler 1c25336520 Merge branch 'master' into x509_req_version_subject 2017-02-11 09:11:25 -08:00
Steven Fackler 03fe3015dc X509 signature algorithm access 2017-02-10 21:37:33 -08:00
Steven Fackler 8e5735d84c X509 signature access 2017-02-10 19:59:11 -08:00
mredlek 8ae424235e Make it compile again.
Make self mut in set_subject_name.
Add assert to prevent a null pointer in subject_name.
2017-02-07 21:49:07 +01:00
mredlek 30a634c877 Merge branch 'master' into x509_req_version_subject 2017-02-07 20:41:27 +01:00