Skip to content

Commit 95550ff

Browse files
committed
switch argument order for the verify method on the provider
1 parent 9bde5aa commit 95550ff

5 files changed

Lines changed: 11 additions & 11 deletions

File tree

rcgen/src/crypto/aws_lc_rs.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -298,10 +298,10 @@ impl CryptoProvider for AwsLcProvider {
298298

299299
fn verify(
300300
&self,
301-
algorithm: &'static SignatureAlgorithm,
302-
public_key: &[u8],
303301
message: &[u8],
304302
signature_bytes: &[u8],
303+
public_key: &[u8],
304+
algorithm: &'static SignatureAlgorithm,
305305
) -> Result<(), Error> {
306306
#[cfg(feature = "aws_lc_rs")]
307307
{
@@ -443,7 +443,7 @@ mod tests {
443443
let message = b"stable ML-DSA provider";
444444
let signature = loaded.sign(message).unwrap();
445445
provider
446-
.verify(algorithm, loaded.der_bytes(), message, &signature)
446+
.verify(message, &signature, loaded.der_bytes(), algorithm)
447447
.unwrap();
448448

449449
#[cfg(feature = "x509-parser")]

rcgen/src/crypto/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ pub trait CryptoProvider: std::fmt::Debug + Send + Sync {
5050
/// STRING contents, matching [`PublicKeyData::der_bytes`](crate::PublicKeyData::der_bytes).
5151
fn verify(
5252
&self,
53-
algorithm: &'static SignatureAlgorithm,
54-
public_key: &[u8],
5553
message: &[u8],
5654
signature: &[u8],
55+
public_key: &[u8],
56+
algorithm: &'static SignatureAlgorithm,
5757
) -> Result<(), Error>;
5858
}
5959

rcgen/src/crypto/ring.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,10 +167,10 @@ impl CryptoProvider for RingProvider {
167167

168168
fn verify(
169169
&self,
170-
algorithm: &'static SignatureAlgorithm,
171-
public_key: &[u8],
172170
message: &[u8],
173171
signature_bytes: &[u8],
172+
public_key: &[u8],
173+
algorithm: &'static SignatureAlgorithm,
174174
) -> Result<(), Error> {
175175
let verification_algorithm: &'static dyn VerificationAlgorithm =
176176
if algorithm == &PKCS_ECDSA_P256_SHA256 {

rcgen/src/csr.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,10 +141,10 @@ impl CertificateSigningRequestParams {
141141

142142
provider
143143
.verify(
144-
alg,
145-
info.subject_pki.subject_public_key.data.as_ref(),
146144
info.raw,
147145
csr.signature_value.data.as_ref(),
146+
info.subject_pki.subject_public_key.data.as_ref(),
147+
alg,
148148
)
149149
.map_err(|error| match error {
150150
Error::UnsupportedSignatureAlgorithm => error,

rcgen/tests/custom_provider.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,10 @@ impl CryptoProvider for TestBackend {
5858

5959
fn verify(
6060
&self,
61-
algorithm: &'static SignatureAlgorithm,
62-
public_key: &[u8],
6361
message: &[u8],
6462
signature: &[u8],
63+
public_key: &[u8],
64+
algorithm: &'static SignatureAlgorithm,
6565
) -> Result<(), Error> {
6666
assert_eq!(algorithm, &PKCS_ED25519);
6767
assert_eq!(public_key, [7; 32]);

0 commit comments

Comments
 (0)