System.Security.Cryptography.CryptographicException

Post here for help with installing or upgrading mojoPortal pre-compiled release packages. When posting in this forum, please provide all relevant details. You may also want to review the installation or upgrading documentation.

If you have questions about using the source code or working with mojoPortal in Visual Studio, please post in the Developer forum.

Post here for help with installation of mojoPortal pre-compiled release packages

When posting in this forum, please try to provide as many relevant details as possible. Particularly the following:

  • What operating system were you running when the bug appeared?
  • What database platform is your site using?
  • What version of mojoPortal are you running?
  • What version of .NET do you use?
  • What steps are necessary to reproduce the issue? Compare expected results vs actual results.

You may also want to review the installation or upgrading documentation.

If you have questions about using the source code or working with mojoPortal in Visual Studio, please post in the Developer forum.

This thread is closed to new posts. You must sign in to post in the forums.
6/19/2009 12:45:58 PM
Gravatar
Total Posts 9

System.Security.Cryptography.CryptographicException

The "real" site is hosted on discountasp.net.   Discountasp is running windows 2003 and Sql Server 2005.

I am basically in place and running from the 5/18/2009 release version plus eventcalendar pro and form wizard.  No source modifications have been made other than to skinning files in the site skins.  I do not speak c#.

I can't say I've been through everything, but most things are working... except Sitesettings.aspx and a piece of whatever goes on during user registration.  Both are failing due to some file missing somewhere that seems to be used in System.Security.  If someone could tell me which file, I'd be grateful.  Thanks!

On attempt to use Admin/Sitesettings.aspx:

2009-06-19 10:12:04,274 ERROR mojoPortal.Web.Global - 68.167.146.229-en-US - /Admin/SiteSettings.aspx
System.Security.Cryptography.CryptographicException: The system cannot find the file specified.
at System.Security.Cryptography.Utils.CreateProvHandle(CspParameters parameters, Boolean randomKeyContainer)
at System.Security.Cryptography.RSACryptoServiceProvider.ImportParameters(RSAParameters parameters)
at System.Security.Cryptography.RSA.FromXmlString(String xmlString)
at mojoPortal.Web.Framework.CryptoHelper.LoadRsaKey()
at mojoPortal.Web.Framework.CryptoHelper.Decrypt(String encryptedText)
at mojoPortal.Web.AdminUI.SiteSettingsPage.PopulateMailSettings()
at mojoPortal.Web.AdminUI.SiteSettingsPage.PopulateControls()
at mojoPortal.Web.AdminUI.SiteSettingsPage.Page_Load(Object sender, EventArgs e)
at System.Web.UI.Control.OnLoad(EventArgs e)
at mojoPortal.Web.mojoBasePage.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

On user registration Error:

2009-06-19 10:35:17,051 ERROR mojoPortal.Web.mojoBasePage - 68.167.146.229-en-US - /Secure/Register.aspx
System.Security.Cryptography.CryptographicException: The system cannot find the file specified.
at System.Security.Cryptography.Utils.CreateProvHandle(CspParameters parameters, Boolean randomKeyContainer)
at System.Security.Cryptography.RSACryptoServiceProvider.ImportParameters(RSAParameters parameters)
at System.Security.Cryptography.RSA.FromXmlString(String xmlString)
at mojoPortal.Web.Framework.CryptoHelper.LoadRsaKey()
at mojoPortal.Web.Framework.CryptoHelper.Decrypt(String encryptedText)
at mojoPortal.Web.SiteUtils.GetSmtpSettings()
at mojoPortal.Web.mojoMembershipProvider.CreateUser(String userName, String password, String email, String passwordQuestion, String passwordAnswer, Boolean isApproved, Object providerUserKey, MembershipCreateStatus& status)
at System.Web.UI.WebControls.CreateUserWizard.AttemptCreateUser()
at System.Web.UI.WebControls.CreateUserWizard.OnNextButtonClick(WizardNavigationEventArgs e)
at System.Web.UI.WebControls.Wizard.OnBubbleEvent(Object source, EventArgs e)
at System.Web.UI.WebControls.CreateUserWizard.OnBubbleEvent(Object source, EventArgs e)
at System.Web.UI.WebControls.Wizard.WizardChildTable.OnBubbleEvent(Object source, EventArgs args)
at System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)
at System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e)
at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
at System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
 

2009-06-19 10:35:17,160 ERROR mojoPortal.Web.Global - 68.167.146.229-en-US - /Secure/Register.aspx
System.Security.Cryptography.CryptographicException: The system cannot find the file specified.
at System.Security.Cryptography.Utils.CreateProvHandle(CspParameters parameters, Boolean randomKeyContainer)
at System.Security.Cryptography.RSACryptoServiceProvider.ImportParameters(RSAParameters parameters)
at System.Security.Cryptography.RSA.FromXmlString(String xmlString)
at mojoPortal.Web.Framework.CryptoHelper.LoadRsaKey()
at mojoPortal.Web.Framework.CryptoHelper.Decrypt(String encryptedText)
at mojoPortal.Web.SiteUtils.GetSmtpSettings()
at mojoPortal.Web.mojoMembershipProvider.CreateUser(String userName, String password, String email, String passwordQuestion, String passwordAnswer, Boolean isApproved, Object providerUserKey, MembershipCreateStatus& status)
at System.Web.UI.WebControls.CreateUserWizard.AttemptCreateUser()
at System.Web.UI.WebControls.CreateUserWizard.OnNextButtonClick(WizardNavigationEventArgs e)
at System.Web.UI.WebControls.Wizard.OnBubbleEvent(Object source, EventArgs e)
at System.Web.UI.WebControls.CreateUserWizard.OnBubbleEvent(Object source, EventArgs e)
at System.Web.UI.WebControls.Wizard.WizardChildTable.OnBubbleEvent(Object source, EventArgs args)
at System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)
at System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e)
at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
at System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

6/19/2009 12:48:32 PM
Gravatar
Total Posts 18439

Re: System.Security.Cryptography.CryptographicException

There should be a file in the root of the Web named mojoEncryption.config, it must be readable by the web process.

Hope it helps,

Joe 

6/19/2009 1:35:41 PM
Gravatar
Total Posts 9

Re: System.Security.Cryptography.CryptographicException

It's there and it's readable as far as I can tell.  It is the same as the one on my local 'puter.  I replaced it with the one from the release and restarted the app and it didn't work.  I don't know if this is helpful --

Anonymous has read/write permissions to EVERYTHING at this point.

Relative to site path /mojoEncryption.config

Actual path: E:\web\herringrunp\htdocs\mojoEncryption.config

6/19/2009 1:38:14 PM
Gravatar
Total Posts 18439

Re: System.Security.Cryptography.CryptographicException

I would upgrade to the newest mojoPortal 2.3.0.8 and also get the latest versions of Event Calendar Pro and Form Wizard Pro from your order history. I'm fairly certain it will solve this for you.

Hope it helps,

Joe 

6/20/2009 8:25:05 AM
Gravatar
Total Posts 9

Re: System.Security.Cryptography.CryptographicException

  Yes, it did.

6/20/2009 9:23:09 PM
Gravatar
Total Posts 9

Re: System.Security.Cryptography.CryptographicException

Ok, well, after further testing, I can make the site settings fail anytime I want to. 

This value in web.config:

<add key="EnableSiteSettingsSmtpSettings" value="false" />

The error will occur if this flag is set to true.  Flag can be true on my little vista test computer with iis7, but not on iis6? or something like that.

6/21/2009 6:32:23 AM
Gravatar
Total Posts 18439

Re: System.Security.Cryptography.CryptographicException

Hi Jill,

So you are saying you still get the cryptographic error if you save site settings when then config option is enabled?

It does encrypt those credentials so if its still having some underlying crypto issue it would show up there.

I'm not able to produce the symptom on my local machine using IIS 7, I tried Classic Mode but it still worked.

Can you tell me some more info about your hosted installation, these things may help me produce the problem.

Is it Medium Trust Hosting? 

What is the structure of the url for your site, a root site or a sub folder?

Configured for multi site hosting? host name based or folder based?

Best,

Joe

6/21/2009 6:36:21 AM
Gravatar
Total Posts 18439

Re: System.Security.Cryptography.CryptographicException

Is the error identical? If not can you post the error detail? First clear the log then cause the error then get the error from the log and post it.

Thanks,

Joe 

6/22/2009 8:06:57 AM
Gravatar
Total Posts 9

Re: System.Security.Cryptography.CryptographicException

This is the log excerpt from changing ONLY that setting with, of course, virgin application start. 
Accessed site home, admin menu then site settings.  The error doesn't happen on save - it happens when site settings page is generated.... It never appears, the generic error message does.  According to the vendor - full trust environment.
==============================================================================================

2009-06-22 05:57:01,621 INFO mojoPortal.Web.Global - Global.asax.cs Application_End
2009-06-22 05:57:20,199 INFO mojoPortal.Web.Global - Application Started.
2009-06-22 05:57:42,200 ERROR mojoPortal.Web.Framework.CryptoHelper - System.Security.Cryptography.CryptographicException: The system cannot find the file specified.

at System.Security.Cryptography.Utils.CreateProvHandle(CspParameters parameters, Boolean randomKeyContainer)
at System.Security.Cryptography.RSACryptoServiceProvider.ImportParameters(RSAParameters parameters)
at System.Security.Cryptography.RSA.FromXmlString(String xmlString)
at mojoPortal.Web.Framework.CryptoHelper.LoadRsaKey()
at mojoPortal.Web.Framework.CryptoHelper..cctor()
2009-06-22 05:57:42,356 ERROR mojoPortal.Web.mojoBasePage - 68.167.146.229-en-US - /Admin/SiteSettings.aspx
System.Security.Cryptography.CryptographicException: The system cannot find the file specified.

at System.Security.Cryptography.Utils.CreateProvHandle(CspParameters parameters, Boolean randomKeyContainer)
at System.Security.Cryptography.RSACryptoServiceProvider.ImportParameters(RSAParameters parameters)
at System.Security.Cryptography.RSA.FromXmlString(String xmlString)
at mojoPortal.Web.Framework.CryptoHelper.LoadRsaKey()
at mojoPortal.Web.Framework.CryptoHelper.Decrypt(String encryptedText)
at mojoPortal.Web.AdminUI.SiteSettingsPage.PopulateMailSettings()
at mojoPortal.Web.AdminUI.SiteSettingsPage.PopulateControls()
at mojoPortal.Web.AdminUI.SiteSettingsPage.Page_Load(Object sender, EventArgs e)
at System.Web.UI.Control.OnLoad(EventArgs e)
at mojoPortal.Web.mojoBasePage.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
2009-06-22 05:57:42,497 ERROR mojoPortal.Web.Global - 68.167.146.229-en-US - /Admin/SiteSettings.aspx
System.Security.Cryptography.CryptographicException: The system cannot find the file specified.

at System.Security.Cryptography.Utils.CreateProvHandle(CspParameters parameters, Boolean randomKeyContainer)
at System.Security.Cryptography.RSACryptoServiceProvider.ImportParameters(RSAParameters parameters)
at System.Security.Cryptography.RSA.FromXmlString(String xmlString)
at mojoPortal.Web.Framework.CryptoHelper.LoadRsaKey()
at mojoPortal.Web.Framework.CryptoHelper.Decrypt(String encryptedText)
at mojoPortal.Web.AdminUI.SiteSettingsPage.PopulateMailSettings()
at mojoPortal.Web.AdminUI.SiteSettingsPage.PopulateControls()
at mojoPortal.Web.AdminUI.SiteSettingsPage.Page_Load(Object sender, EventArgs e)
at System.Web.UI.Control.OnLoad(EventArgs e)
at mojoPortal.Web.mojoBasePage.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
 

6/22/2009 8:46:31 AM
Gravatar
Total Posts 18439

Re: System.Security.Cryptography.CryptographicException

Hi Jill,

Its difficult to figure out for sure what is causing this without being able to produce the problem.

Nevertheless I've tried some re-factoring of the CryptoHelper that "may" solve it. I've emailed you a new version of mojoPortal.Web.Framework.dll, can you back up your current version of that file and see if the new version solves it.

Also make sure the mojoEncryption.config file has an RSA key in it, if the file were corrupted during upload it could cause this.

Hope it helps,

Joe

6/22/2009 9:57:47 PM
Gravatar
Total Posts 9

Re: System.Security.Cryptography.CryptographicException

Sorry for the delay.  This is with the new dll - looks the same to me.

2009-06-22 19:31:52,447 INFO mojoPortal.Web.Global - Global.asax.cs Application_End
2009-06-22 19:39:58,457 INFO mojoPortal.Web.Global - Application Started.
2009-06-22 19:52:14,143 ERROR mojoPortal.Web.mojoBasePage - 68.167.146.229-en-US - /Admin/SiteSettings.aspx
System.Security.Cryptography.CryptographicException: The system cannot find the file specified.

at System.Security.Cryptography.Utils.CreateProvHandle(CspParameters parameters, Boolean randomKeyContainer)
at System.Security.Cryptography.RSACryptoServiceProvider.ImportParameters(RSAParameters parameters)
at System.Security.Cryptography.RSA.FromXmlString(String xmlString)
at mojoPortal.Web.Framework.CryptoHelper.Decrypt(String encryptedText)
at mojoPortal.Web.AdminUI.SiteSettingsPage.PopulateMailSettings()
at mojoPortal.Web.AdminUI.SiteSettingsPage.PopulateControls()
at mojoPortal.Web.AdminUI.SiteSettingsPage.Page_Load(Object sender, EventArgs e)
at System.Web.UI.Control.OnLoad(EventArgs e)
at mojoPortal.Web.mojoBasePage.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
2009-06-22 19:52:14,439 ERROR mojoPortal.Web.Global - 68.167.146.229-en-US - /Admin/SiteSettings.aspx
System.Security.Cryptography.CryptographicException: The system cannot find the file specified.

at System.Security.Cryptography.Utils.CreateProvHandle(CspParameters parameters, Boolean randomKeyContainer)
at System.Security.Cryptography.RSACryptoServiceProvider.ImportParameters(RSAParameters parameters)
at System.Security.Cryptography.RSA.FromXmlString(String xmlString)
at mojoPortal.Web.Framework.CryptoHelper.Decrypt(String encryptedText)
at mojoPortal.Web.AdminUI.SiteSettingsPage.PopulateMailSettings()
at mojoPortal.Web.AdminUI.SiteSettingsPage.PopulateControls()
at mojoPortal.Web.AdminUI.SiteSettingsPage.Page_Load(Object sender, EventArgs e)
at System.Web.UI.Control.OnLoad(EventArgs e)
at mojoPortal.Web.mojoBasePage.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
 

You must sign in to post in the forums. This thread is closed to new posts.