Key not valid for use in specified state

Posted by Community Admin on 03-Aug-2018 19:44

Key not valid for use in specified state

All Replies

Posted by Community Admin on 31-Oct-2010 00:00

Came across the error below out of the blue today, and we can't figure out what's causing it.  We have a big demo tomorrow of our site built on Sitefinity 4.0 beta 2, and everything has stopped working today.  I've looked at all types of other forums with information about similar errors, but nothing that helps me solve this in the context of Sitefinity.  Please help...


Thanks,
Matt

Key not valid for use in specified state.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.Security.Cryptography.CryptographicException: Key not valid for use in specified state.


Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace: 

[CryptographicException: Key not valid for use in specified state.
]
   System.Security.Cryptography.Utils.CreateProvHandle(CspParameters parameters, Boolean randomKeyContainer) +9719295
   System.Security.Cryptography.Utils.get_StaticDssProvHandle() +156
   System.Security.Cryptography.DSACryptoServiceProvider.ImportParameters(DSAParameters parameters) +144
   System.Security.Cryptography.DSA.FromXmlString(String xmlString) +620
   Telerik.OpenAccess.SPI.License.GetDSA(CspProviderFlags flags, Boolean temp, Boolean priv) +147
   Telerik.OpenAccess.SPI.License.Provider(Boolean temp, Boolean priv) +78
   Telerik.OpenAccess.SPI.ConfigCollector.CheckLicense(String s, Boolean& allowRemote) +154
   Telerik.OpenAccess.RT.PersistentClassesRegistry.CheckLicense() +249
   OpenAccessRuntime.Relational.conn.RelationalConnectionPool.createRealCon() +818
   OpenAccessRuntime.Relational.conn.RelationalConnectionPool.init() +96
   OpenAccessRuntime.Relational.RelationalStorageManagerFactory.connect() +21
   OpenAccessRuntime.Relational.RelationalStorageManagerFactory..ctor(StorageManagerFactoryBuilder b) +704
   OpenAccessRuntime.storagemanager.StorageManagerFactoryBuilder.createSmfForURL() +82

[OpenAccessException: System.Security.Cryptography.CryptographicException: Key not valid for use in specified state.

   at System.Security.Cryptography.Utils.CreateProvHandle(CspParameters parameters, Boolean randomKeyContainer)
   at System.Security.Cryptography.Utils.get_StaticDssProvHandle()
   at System.Security.Cryptography.DSACryptoServiceProvider.ImportParameters(DSAParameters parameters)
   at System.Security.Cryptography.DSA.FromXmlString(String xmlString)
   at Telerik.OpenAccess.SPI.License.GetDSA(CspProviderFlags flags, Boolean temp, Boolean priv)
   at Telerik.OpenAccess.SPI.License.Provider(Boolean temp, Boolean priv)
   at Telerik.OpenAccess.SPI.ConfigCollector.CheckLicense(String s, Boolean& allowRemote)
   at Telerik.OpenAccess.RT.PersistentClassesRegistry.CheckLicense()
   at OpenAccessRuntime.Relational.conn.RelationalConnectionPool.createRealCon()
   at OpenAccessRuntime.Relational.conn.RelationalConnectionPool.init()
   at OpenAccessRuntime.Relational.RelationalStorageManagerFactory.connect()
   at OpenAccessRuntime.Relational.RelationalStorageManagerFactory..ctor(StorageManagerFactoryBuilder b)
   at OpenAccessRuntime.storagemanager.StorageManagerFactoryBuilder.createSmfForURL()]
   DynamicModule.ns.Wrapped_OpenAccessTaxonomyProvider_fefaded8e905421dacc117d1d8057a48.Initialize(String providerName, NameValueCollection config, Type managerType) +197
   Telerik.Sitefinity.Data.ManagerBase`1.InstantiateProvider(DataProviderSettings providerSettings, Type providerType, ExceptionPolicyName policy, ManagerBase`1 manager) +1236
   Telerik.Sitefinity.Data.ManagerBase`1.InstantiateProvider(DataProviderSettings providerSettings, ExceptionPolicyName policy, ManagerBase`1 manager) +63
   Telerik.Sitefinity.Data.ManagerBase`1.SetProvider(String providerName, String transactionName) +166
   Telerik.Sitefinity.Data.ManagerBase`1..ctor(String providerName, String transactionName) +123
   Telerik.Sitefinity.Taxonomies.TaxonomyManager..ctor() +12

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
   System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) +0
   System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache) +98
   System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean skipCheckThis, Boolean fillCache) +241
   System.Activator.CreateInstance() +103
   Telerik.Sitefinity.Data.ManagerBase`1.GetManager(String providerName, String transactionName) +85
   Telerik.Sitefinity.Modules.DefinitionsHelper.CreateTaxonomyLink(Guid id, String commandName, String commandArgument, WidgetBarSectionElement sidebar) +75
   Telerik.Sitefinity.Modules.GenericContent.ContentDefinitions.DefineContentBackendContentView(ConfigElement parent) +6496
   Telerik.Sitefinity.Web.UI.ContentUI.Config.ContentViewConfig.OnPropertiesLoaded() +66
   Telerik.Sitefinity.Configuration.Data.XmlConfigProvider.LoadSection(ConfigSection section, ConfigPolicyHandler policyHandler, String policyName) +88
   Telerik.Sitefinity.Configuration.ConfigSection.Initialize(ConfigProvider provider, ConfigPolicyHandler policyHandler, String policyName, Boolean singlePolicy) +149
   Telerik.Sitefinity.Configuration.ConfigSection.Initialize(ConfigProvider provider) +16
   Telerik.Sitefinity.Configuration.Config.Get() +128
   Telerik.Sitefinity.Modules.News.NewsModule.Initialize(ModuleSettings settings) +47
   Telerik.Sitefinity.Services.SystemManager.InitializeModule(ModuleSettings settings, Boolean start) +88
   Telerik.Sitefinity.Services.SystemManager.Initialize() +620
   Telerik.Sitefinity.Abstractions.Bootstrapper.RegisterRoutes(RouteCollection routes) +1530
   Telerik.Sitefinity.Abstractions.Bootstrapper.Bootstrap() +84
   Telerik.Sitefinity.Web.SitefinityHttpModule.Init(HttpApplication context) +24
   System.Web.Routing.UrlRoutingModule.System.Web.IHttpModule.Init(HttpApplication application) +10
   System.Web.HttpApplication.InitModulesCommon() +166
   System.Web.HttpApplication.InitModules() +46
   System.Web.HttpApplication.InitInternal(HttpContext context, HttpApplicationState state, MethodInfo[] handlers) +801
   System.Web.HttpApplicationFactory.GetNormalApplicationInstance(HttpContext context) +300
   System.Web.HttpApplicationFactory.GetApplicationInstance(HttpContext context) +120
   System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +327

Posted by Community Admin on 31-Oct-2010 00:00

Okay, I think we are back up and running... most likely related to a windows update that ran last night.  I ended up going to this folder and deleting the encryption key, and then it worked after restarting IIS:

C:\Documents and Settings\<machine-name>\ASPNET\Application Data\Microsoft\Crypto\DSS

Not sure how I ended up trying this, other than this really old blog post that had very little to do with my problem... just enough to point me in the right direction:
http://www.willasrari.com/blog/key-not-valid-for-use-in-specified-state/000151.aspx

Posted by Community Admin on 23-Nov-2010 00:00

I've got the same problem with SF 4.0 RC after Windows updates. I tried to go back and it didn't work either. I'm using Win XP Pro SP 3 IIS 5.1. Any ideas ? Thanks!

Posted by Community Admin on 23-Nov-2010 00:00

Hi John,

This could happen if the user that runs the ASP.NET Worker process

- has issues to access the Cryptography provider of the system - the user does not have rights to do this.
- you are trying to run the project in some unc or share configuration.

Try to rollback the changes you have made before you get this error to narrow down the issue. You could also try to run the project through Visual Studio 2010

Regards,
Ivan Dimitrov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 28-Dec-2010 00:00

I struggled with this for 6 hours today (on my day off) did a fresh mssql r2 instal, fresh vs 2010 instal, finally deleted files here and fixed the problem  ...C:\Documents and settings\.xxxx\Application Data\Microsoft\Crypto\RSA\Machinekeys\XXXXX"


(win 7 machine)



Posted by Community Admin on 13-Sep-2011 00:00

I have VM-WARE VM Windows7 Enterprise (64) and deleted the files on this foler
C:\ProgramData\Microsoft\Crypto\RSA\MachineKeys
browse the url and then the exception went away, it worked fine. Then I undo the delete and browse again and still works fine.

This thread is closed