Re: Error Verifying Xml Digital Signature
From: Aaron (aza_rc@yahoo.com)
Date: 08/22/02
- Next message: Kim Bach Petersen: "Re: Encrypt using password"
- Previous message: Patrick Long: "Re: Windows Authentication, Custom Error Page HELP!!!!!!!!!!"
- In reply to: Aaron: "Error Verifying Xml Digital Signature"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
From: aza_rc@yahoo.com (Aaron) Date: 22 Aug 2002 01:10:03 -0700
Found the fix after trawling through this newsgroup.
Just in case other people are looking the fix is,
CspParameters cspParam = new CspParameters();
cspParam.Flags = CspProviderFlags.UseMachineKeyStore;
RSACryptoServiceProvider rsa = new RSACryptoServiceProvider(cspParam);
Apparently the default constructor for the RSA or DSA provider tries
to open the current users key store as part of its constructor. This
works ok on a client application but not for the non interactive
asp.net user. The above code switches the constructor to using the
machine store instead.
Thanks to the original poster.
aza_rc@yahoo.com (Aaron) wrote in message news:<2836a31b.0208210747.7a746655@posting.google.com>...
> Hello,
>
> I am getting an error when I verify an xml digital signature in a web
> service, the verification suceeds outside of the asp.net environment.
> The error reported is,
>
> "... CryptoAPI cryptographic servie provider (CSP) for this
> implementation could not be acquired. at
> System.Security.Cryptography.RSACryptoServiceProvider..ctor() ... "
>
> The code I am using is shown below. The digital signature has been
> generated and saved to file (using the SignedXml class).
>
> XmlDocument xmlSigned = new XmlDocument();
> xmlSigned.Load(SigFileName);
> SignedXml signedXml = new SignedXml();
> Error Here ==> signedXml.LoadXml((XmlElement)xmlSigned.DocumentElement)
> return ignedXml.CheckSignature();
>
> I get the same error using a DSA key instead of an RSA key. I have
> also changed the code access permissions of the assembly to full
> access in case it was a problem with permissions to unmanaged code but
> this made no difference.
>
> Thanks,
>
> Aaron Clauson
- Next message: Kim Bach Petersen: "Re: Encrypt using password"
- Previous message: Patrick Long: "Re: Windows Authentication, Custom Error Page HELP!!!!!!!!!!"
- In reply to: Aaron: "Error Verifying Xml Digital Signature"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|