Skip to content

Commit

Permalink
trust_anchor/end_entity: rework deprecation notes.
Browse files Browse the repository at this point in the history
In 0.101.2 we deprecated the `TlsServerTrustAnchors` and
`TlsClientTrustAnchors` types along with the
`EndEntity::verify_is_valid_tls_server_cert` and
`EndEntity::verify_is_valid_tls_client_cert` functions that used them.

However, only the `EndEntity` deprecations had a `note` pointing to the
preferred replacement, and the text was quite terse.

This commit adds notes to the trust anchor types that were missing
these, and updates the end entity verification deprecation notes to be
more user-friendly.
  • Loading branch information
cpu committed Aug 8, 2023
1 parent bef457f commit 1f2a8a2
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 4 deletions.
16 changes: 14 additions & 2 deletions src/end_entity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,13 @@ impl<'a> EndEntityCert<'a> {
/// `time` is the time for which the validation is effective (usually the
/// current time).
#[allow(deprecated)]
#[deprecated(since = "0.101.2", note = "Use `verify_for_usage` instead")]
#[deprecated(
since = "0.101.2",
note = "The per-usage trust anchor representations and verification functions are deprecated in \
favor of the general-purpose `TrustAnchor` type and `EndEntity::verify_for_usage` function. \
The new `verify_for_usage` function expresses trust anchor and end entity purpose with the \
key usage argument."
)]
pub fn verify_is_valid_tls_server_cert(
&self,
supported_sig_algs: &[&SignatureAlgorithm],
Expand Down Expand Up @@ -173,7 +179,13 @@ impl<'a> EndEntityCert<'a> {
/// the time for which the validation is effective (usually the current
/// time).
#[allow(deprecated)]
#[deprecated(since = "0.101.2", note = "Use `verify_for_usage` instead")]
#[deprecated(
since = "0.101.2",
note = "The per-usage trust anchor representations and verification functions are deprecated in \
favor of the general-purpose `TrustAnchor` type and `EndEntity::verify_for_usage` function. \
The new `verify_for_usage` function expresses trust anchor and end entity purpose with the \
key usage argument."
)]
pub fn verify_is_valid_tls_client_cert(
&self,
supported_sig_algs: &[&SignatureAlgorithm],
Expand Down
16 changes: 14 additions & 2 deletions src/trust_anchor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,24 @@ pub struct TrustAnchor<'a> {
}

/// Trust anchors which may be used for authenticating servers.
#[deprecated(since = "0.101.2")]
#[deprecated(
since = "0.101.2",
note = "The per-usage trust anchor representations and verification functions are deprecated in \
favor of the general-purpose `TrustAnchor` type and `EndEntity::verify_for_usage` function. \
The new `verify_for_usage` function expresses trust anchor and end entity purpose with the \
key usage argument."
)]
#[derive(Debug)]
pub struct TlsServerTrustAnchors<'a>(pub &'a [TrustAnchor<'a>]);

/// Trust anchors which may be used for authenticating clients.
#[deprecated(since = "0.101.2")]
#[deprecated(
since = "0.101.2",
note = "The per-usage trust anchor representations and verification functions are deprecated in \
favor of the general-purpose `TrustAnchor` type and `EndEntity::verify_for_usage` function. \
The new `verify_for_usage` function expresses trust anchor and end entity purpose with the \
key usage argument."
)]
#[derive(Debug)]
pub struct TlsClientTrustAnchors<'a>(pub &'a [TrustAnchor<'a>]);

Expand Down

0 comments on commit 1f2a8a2

Please sign in to comment.