File tree Expand file tree Collapse file tree 1 file changed +12
-7
lines changed Expand file tree Collapse file tree 1 file changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -319,11 +319,16 @@ public byte[] GetEncodedSignedAttributes()
319
319
private bool DoVerify (
320
320
AsymmetricKeyParameter key )
321
321
{
322
- string digestName = Helper . GetDigestAlgName ( this . DigestAlgOid ) ;
323
- IDigest digest = Helper . GetDigestInstance ( digestName ) ;
324
-
325
- DerObjectIdentifier sigAlgOid = this . encryptionAlgorithm . Algorithm ;
322
+ DerObjectIdentifier sigAlgOid = this . encryptionAlgorithm . Algorithm ;
326
323
Asn1Encodable sigParams = this . encryptionAlgorithm . Parameters ;
324
+ string digestName = Helper . GetDigestAlgName ( this . EncryptionAlgOid ) ;
325
+
326
+ if ( digestName . Equals ( sigAlgOid . Id ) )
327
+ {
328
+ digestName = Helper . GetDigestAlgName ( this . DigestAlgOid ) ;
329
+ }
330
+
331
+ IDigest digest = Helper . GetDigestInstance ( digestName ) ;
327
332
ISigner sig ;
328
333
329
334
if ( sigAlgOid . Equals ( Asn1 . Pkcs . PkcsObjectIdentifiers . IdRsassaPss ) )
@@ -374,10 +379,10 @@ private bool DoVerify(
374
379
else
375
380
{
376
381
// TODO Probably too strong a check at the moment
377
- // if (sigParams != null)
378
- // throw new CmsException("unrecognised signature parameters provided");
382
+ // if (sigParams != null)
383
+ // throw new CmsException("unrecognised signature parameters provided");
379
384
380
- string signatureName = digestName + "with" + Helper . GetEncryptionAlgName ( this . EncryptionAlgOid ) ;
385
+ string signatureName = digestName + "with" + Helper . GetEncryptionAlgName ( this . EncryptionAlgOid ) ;
381
386
382
387
sig = Helper . GetSignatureInstance ( signatureName ) ;
383
388
You can’t perform that action at this time.
0 commit comments