Skip to content

Commit 49dbc6d

Browse files
committed
x509-cert: builder: use DynSignatureAlgorithmIdentifier for S
RSA PSS implements DynSignatureAlgorithmIdentifier only for the SigningKey, not for the verifying key. To allow using CertificateBuilder with RSA PSS keys require DynSignatureAlgorithmIdentifier implementation on S rather than on S::VerifyingKey. This also follows the following logic: verifying key can possibly verify several kinds of signatures, while for the signing key we must know exact signature kind and parameters. Signed-off-by: Dmitry Baryshkov <[email protected]>
1 parent 48e919a commit 49dbc6d

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

x509-cert/src/builder.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -238,9 +238,8 @@ pub struct CertificateBuilder<'s, S> {
238238

239239
impl<'s, S> CertificateBuilder<'s, S>
240240
where
241-
S: Keypair,
241+
S: Keypair + DynSignatureAlgorithmIdentifier,
242242
S::VerifyingKey: EncodePublicKey,
243-
S::VerifyingKey: DynSignatureAlgorithmIdentifier,
244243
{
245244
/// Creates a new certificate builder
246245
pub fn new<Signature>(
@@ -260,7 +259,7 @@ where
260259
.to_public_key_der()?
261260
.decode_msg::<SubjectPublicKeyInfoOwned>()?;
262261

263-
let signature_alg = verifying_key.signature_algorithm_identifier()?;
262+
let signature_alg = signer.signature_algorithm_identifier()?;
264263
let issuer = profile.get_issuer(&subject);
265264

266265
validity.not_before.rfc5280_adjust_utc_time()?;

0 commit comments

Comments
 (0)