unknown Error while Validating Signature with System.Security.Cryptography.Pkcs

Viewed 160

I am trying to validate Signatures using System.Security.Cryptography.Pkcs with the following SourceCode

 SignedCms signedData = new SignedCms();
 signedData.Decode(Convert.FromBase64String(input));
 signedData.CheckSignature(true);
 return true;

I get an CryptographyException saying "unkown Error" (in German "Unbekannter Fehler" and Code -1073700864)

 System.Security.Cryptography.CryptographicException
  HResult=0xC000A000
  Nachricht = Unbekannter Fehler -1073700864.
  Quelle = System.Security
  Stapelüberwachung:
   bei System.Security.Cryptography.Pkcs.SignerInfo.Verify(X509Certificate2Collection extraStore, X509Certificate2 certificate, Boolean verifySignatureOnly)
   bei System.Security.Cryptography.Pkcs.SignerInfo.CheckSignature(X509Certificate2Collection extraStore, Boolean verifySignatureOnly)
   bei System.Security.Cryptography.Pkcs.SignedCms.CheckSignatures(SignerInfoCollection signers, X509Certificate2Collection extraStore, Boolean verifySignatureOnly)
   bei System.Security.Cryptography.Pkcs.SignedCms.CheckSignature(X509Certificate2Collection extraStore, Boolean verifySignatureOnly)
   bei System.Security.Cryptography.Pkcs.SignedCms.CheckSignature(Boolean verifySignatureOnly)
   bei Ars.Basics.ERezept.EDispensierung.Encryption.PkcsCryptoService.VerifySignature(String input) in C:\Entwicklung\ARS\Basics\Ars.Basics.Erezept\Development\Ars.Basics.Erezept.EDispensierung\Encryption\PkcsCryptoService.cs: Zeile21
   bei TestConsole.Program.SignatureTest() in C:\Entwicklung\ARS\Basics\Ars.Basics.Erezept\Development\TestConsole\Program.cs: Zeile114
   bei TestConsole.Program.Main(String[] args) in C:\Entwicklung\ARS\Basics\Ars.Basics.Erezept\Development\TestConsole\Program.cs: Zeile99

Does anyone know, what's the Problem.

The Message seems to be properly decoded because in signedData.ContentInfo.Content i get the proper Content.

0 Answers
Related