Skip to content

Commit b7dcc93

Browse files
jalil-salamechifflier
authored andcommitted
fix(verify): also enable all functions when using verify-aws
Otherwise you are missing part of the API.
1 parent 8801945 commit b7dcc93

File tree

9 files changed

+19
-18
lines changed

9 files changed

+19
-18
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,14 +83,14 @@ See also `examples/print-cert.rs`.
8383

8484
# Features
8585

86-
- The `verify` feature adds support for (cryptographic) signature verification, based on `ring`.
86+
- The `verify` and `verify-aws` features adds support for (cryptographic) signature verification, based on `ring` or `aws-lc` respectively.
8787
It adds the
8888
[`X509Certificate::verify_signature()`](https://docs.rs/x509-parser/latest/x509_parser/certificate/struct.X509Certificate.html#method.verify_signature)
8989
to `X509Certificate`.
9090

9191
```rust
9292
/// Cryptographic signature verification: returns true if certificate was signed by issuer
93-
#[cfg(feature = "verify")]
93+
#[cfg(any(feature = "verify", feature = "verify-aws"))]
9494
pub fn check_signature(cert: &X509Certificate<'_>, issuer: &X509Certificate<'_>) -> bool {
9595
let issuer_public_key = issuer.public_key();
9696
cert

examples/print-cert.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ fn print_x509_info(x509: &X509Certificate) -> io::Result<()> {
215215
{
216216
println!("Unknown (feature 'validate' not enabled)");
217217
}
218-
#[cfg(feature = "verify")]
218+
#[cfg(any(feature = "verify", feature = "verify-aws"))]
219219
{
220220
print!("Signature verification: ");
221221
if x509.subject() == x509.issuer() {

src/certificate.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use crate::x509::{
1010
X509Name, X509Version,
1111
};
1212

13-
#[cfg(feature = "verify")]
13+
#[cfg(any(feature = "verify", feature = "verify-aws"))]
1414
use crate::verify::verify_signature;
1515
use asn1_rs::{
1616
Alias, BerError, BigUint, BitString, DerParser, Error, FromDer, Header, Input,
@@ -100,8 +100,8 @@ impl<'a> X509Certificate<'a> {
100100
/// It is usually an intermediate authority.
101101
///
102102
/// Not all algorithms are supported, this function is limited to what `ring` supports.
103-
#[cfg(feature = "verify")]
104-
#[cfg_attr(docsrs, doc(cfg(feature = "verify")))]
103+
#[cfg(any(feature = "verify", feature = "verify-aws"))]
104+
#[cfg_attr(docsrs, doc(cfg(any(feature = "verify", feature = "verify-aws"))))]
105105
pub fn verify_signature(
106106
&self,
107107
public_key: Option<&SubjectPublicKeyInfo>,

src/certification_request.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use crate::x509::{
55
parse_signature_value, AlgorithmIdentifier, SubjectPublicKeyInfo, X509Name, X509Version,
66
};
77

8-
#[cfg(feature = "verify")]
8+
#[cfg(any(feature = "verify", feature = "verify-aws"))]
99
use crate::verify::verify_signature;
1010
use asn1_rs::{
1111
BitString, DerParser, FromDer, Header, Input, Oid, OptTaggedImplicit, Sequence, Tag, Tagged,
@@ -83,7 +83,8 @@ impl<'a> X509CertificationRequest<'a> {
8383
///
8484
/// Uses the public key contained in the CSR, which must be the one of the entity
8585
/// requesting the certification for this verification to succeed.
86-
#[cfg(feature = "verify")]
86+
#[cfg(any(feature = "verify", feature = "verify-aws"))]
87+
#[cfg_attr(docsrs, doc(cfg(any(feature = "verify", feature = "verify-aws"))))]
8788
pub fn verify_signature(&self) -> Result<(), X509Error> {
8889
let spki = &self.certification_request_info.subject_pki;
8990
verify_signature(

src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,16 +87,16 @@
8787
//!
8888
//! # Features
8989
//!
90-
//! - The `verify` feature adds support for (cryptographic) signature verification, based on `ring`.
90+
//! - The `verify` and `verify-aws` features adds support for (cryptographic) signature verification, based on `ring` or `aws-lc` respectively.
9191
//! It adds the
9292
//! [`X509Certificate::verify_signature()`](certificate/struct.X509Certificate.html#method.verify_signature)
9393
//! to `X509Certificate`.
9494
//!
9595
//! ```rust
96-
//! # #[cfg(feature = "verify")]
96+
//! # #[cfg(any(feature = "verify", feature = "verify-aws"))]
9797
//! # use x509_parser::certificate::X509Certificate;
9898
//! /// Cryptographic signature verification: returns true if certificate was signed by issuer
99-
//! #[cfg(feature = "verify")]
99+
//! #[cfg(any(feature = "verify", feature = "verify-aws"))]
100100
//! pub fn check_signature(cert: &X509Certificate<'_>, issuer: &X509Certificate<'_>) -> bool {
101101
//! let issuer_public_key = issuer.public_key();
102102
//! cert

src/revocation_list.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ use crate::x509::{
55
format_serial, parse_serial, AlgorithmIdentifier, ReasonCode, X509Name, X509Version,
66
};
77

8-
#[cfg(feature = "verify")]
8+
#[cfg(any(feature = "verify", feature = "verify-aws"))]
99
use crate::verify::verify_signature;
10-
#[cfg(feature = "verify")]
10+
#[cfg(any(feature = "verify", feature = "verify-aws"))]
1111
use crate::x509::SubjectPublicKeyInfo;
1212
use asn1_rs::num_bigint::BigUint;
1313
use asn1_rs::{BitString, DerParser, FromDer, Header, Input, Sequence, Tag, Tagged};
@@ -137,8 +137,8 @@ impl<'a> CertificateRevocationList<'a> {
137137
/// `public_key` is the public key of the **signer**.
138138
///
139139
/// Not all algorithms are supported, this function is limited to what `ring` supports.
140-
#[cfg(feature = "verify")]
141-
#[cfg_attr(docsrs, doc(cfg(feature = "verify")))]
140+
#[cfg(any(feature = "verify", feature = "verify-aws"))]
141+
#[cfg_attr(docsrs, doc(cfg(any(feature = "verify", feature = "verify-aws"))))]
142142
pub fn verify_signature(&self, public_key: &SubjectPublicKeyInfo) -> Result<(), X509Error> {
143143
verify_signature(
144144
public_key,

tests/readcrl.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use x509_parser::prelude::*;
22

3-
#[cfg(feature = "verify")]
3+
#[cfg(any(feature = "verify", feature = "verify-aws"))]
44
#[test]
55
fn read_crl_verify() {
66
const CA_DATA: &[u8] = include_bytes!("../assets/ca_minimalcrl.der");

tests/readcsr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ fn read_csr_with_challenge_password() {
115115
assert!(found_san);
116116
}
117117

118-
#[cfg(feature = "verify")]
118+
#[cfg(any(feature = "verify", feature = "verify-aws"))]
119119
#[test]
120120
fn read_csr_verify() {
121121
let pem = pem::parse_x509_pem(CSR_DATA).unwrap().1;

tests/verify.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![cfg(feature = "verify")]
1+
#![cfg(any(feature = "verify", feature = "verify-aws"))]
22

33
use x509_parser::parse_x509_certificate;
44

0 commit comments

Comments
 (0)