+1-888-365-2779
Try Now
More in this section

Forums / General Discussions / Key not valid for use in specified state

Key not valid for use in specified state

6 posts, 0 answered
  1. Matt
    Matt avatar
    56 posts
    Registered:
    20 Nov 2009
    31 Oct 2010
    Link to this post
    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
    

  2. Matt
    Matt avatar
    56 posts
    Registered:
    20 Nov 2009
    31 Oct 2010
    Link to this post
    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:

  3. John
    John avatar
    4 posts
    Registered:
    21 Oct 2010
    23 Nov 2010
    Link to this post
    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!
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    23 Nov 2010
    Link to this post
    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
  5. User
    User avatar
    3 posts
    Registered:
    27 Dec 2010
    28 Dec 2010
    Link to this post
    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)



  6. Luis
    Luis avatar
    1 posts
    Registered:
    26 May 2009
    13 Sep 2011
    Link to this post
    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.

6 posts, 0 answered