Bug 183618 - [69cat] CryptUnprotectData failed: -2146893813
[69cat] CryptUnprotectData failed: -2146893813
Status: RESOLVED WORKSFORME
Product: platform
Classification: Unclassified
Component: Options&Settings
6.x
PC Windows 7 x64
: P3 (vote)
: TBD
Assigned To: Jesse Glick
issues@platform
:
Depends on: 197205
Blocks: 173413
  Show dependency treegraph
 
Reported: 2010-04-07 05:03 UTC by laurin1
Modified: 2011-03-29 17:12 UTC (History)
0 users

See Also:
Issue Type: DEFECT
:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description laurin1 2010-04-07 05:03:59 UTC
Product Version = NetBeans IDE Dev (Build 2010-04-07_00-04-28 )
Operating System = Windows 7 version 6.1 running on x86
Java; VM; Vendor = 1.6.0_19
Runtime = Java HotSpot(TM) Client VM 16.2-b04

This occurs on two of my systems, but on my third machine it works fine. All are Windows 7 x64.

FINEST [org.netbeans.modules.keyring]: reading: org.netbeans.modules.php.project.connections.ftp.FtpConfiguration.ftp.aadallas.org.password
FINE [org.netbeans.modules.keyring.kde.KWalletProvider]: exception thrown while invoking the command "[qdbus, org.kde.kwalletd, /modules/kwalletd, org.kde.KWallet.isEnabled]"
java.io.IOException: CreateProcess error=2, The system cannot find the file specified
	at java.lang.ProcessImpl.create(Native Method)
	at java.lang.ProcessImpl.<init>(Unknown Source)
	at java.lang.ProcessImpl.start(Unknown Source)
Caused: java.io.IOException: Cannot run program "qdbus": CreateProcess error=2, The system cannot find the file specified
	at java.lang.ProcessBuilder.start(Unknown Source)
	at java.lang.Runtime.exec(Unknown Source)
	at java.lang.Runtime.exec(Unknown Source)
	at org.netbeans.modules.keyring.kde.KWalletProvider.runCommand(KWalletProvider.java:148)
	at org.netbeans.modules.keyring.kde.KWalletProvider.enabled(KWalletProvider.java:70)
	at org.netbeans.api.keyring.Keyring.provider(Keyring.java:67)
	at org.netbeans.api.keyring.Keyring.read(Keyring.java:88)
	at org.netbeans.modules.php.project.connections.spi.RemoteConfiguration.readPassword(RemoteConfiguration.java:203)
	at org.netbeans.modules.php.project.connections.ftp.FtpConfiguration.<init>(FtpConfiguration.java:70)
	at org.netbeans.modules.php.project.connections.ftp.FtpConnectionProvider.getRemoteConfiguration(FtpConnectionProvider.java:121)
	at org.netbeans.modules.php.project.connections.RemoteConnections.getRemoteConfiguration(RemoteConnections.java:153)
	at org.netbeans.modules.php.project.connections.RemoteConnections.getRemoteConfigurations(RemoteConnections.java:196)
	at org.netbeans.modules.php.project.connections.RemoteConnections.remoteConfigurationForName(RemoteConnections.java:213)
	at org.netbeans.modules.php.project.copysupport.RemoteOperationFactory.getRemoteConfiguration(RemoteOperationFactory.java:265)
	at org.netbeans.modules.php.project.copysupport.RemoteOperationFactory.isRemoteConfigValid(RemoteOperationFactory.java:206)
	at org.netbeans.modules.php.project.copysupport.RemoteOperationFactory.isValid(RemoteOperationFactory.java:182)
	at org.netbeans.modules.php.project.copysupport.RemoteOperationFactory.access$100(RemoteOperationFactory.java:68)
	at org.netbeans.modules.php.project.copysupport.RemoteOperationFactory$1.call(RemoteOperationFactory.java:124)
	at org.netbeans.modules.php.project.copysupport.RemoteOperationFactory$1.call(RemoteOperationFactory.java:120)
	at org.netbeans.modules.php.project.copysupport.CopySupport$ProxyOperationFactory$ProxyHandler.callRemote(CopySupport.java:473)
	at org.netbeans.modules.php.project.copysupport.CopySupport$ProxyOperationFactory$ProxyHandler.call(CopySupport.java:420)
	at org.netbeans.modules.php.project.copysupport.CopySupport$ProxyOperationFactory$ProxyHandler.call(CopySupport.java:408)
[catch] at org.netbeans.modules.php.project.copysupport.CopySupport$2.run(CopySupport.java:133)
	at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1369)
	at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:1907)
FINE [org.netbeans.modules.keyring.gnome.GnomeProvider]: GNOME_KEYRING_SOCKET not set
FINE [org.netbeans.modules.keyring.fallback.FallbackProvider]: Using provider: org.netbeans.modules.keyring.win32.Win32Protect@a7c257
FINE [org.netbeans.modules.keyring.Utils]: chmod go-r C:\Users\keithdavis\.netbeans\dev\config\Preferences\org\netbeans\modules\keyring\win32.properties
FINE [org.netbeans.modules.keyring.fallback.FallbackProvider]: failed to decrypt sample key
java.lang.Exception: CryptUnprotectData failed
	at org.netbeans.modules.keyring.win32.Win32Protect.decrypt(Win32Protect.java:110)
	at org.netbeans.modules.keyring.fallback.FallbackProvider.testSampleKey(FallbackProvider.java:97)
	at org.netbeans.modules.keyring.fallback.FallbackProvider.enabled(FallbackProvider.java:77)
	at org.netbeans.api.keyring.Keyring.provider(Keyring.java:67)
	at org.netbeans.api.keyring.Keyring.read(Keyring.java:88)
Comment 1 Jesse Glick 2010-04-07 17:34:17 UTC
OK... CryptUnprotectData (from Crypt32.dll) is returning an error code. I will improve the logging to say what that code is:

core-main #55904b374827

Once that fix makes it into dev builds, I will need to see the corresponding part of your log again (the error message mentioning CryptUnprotectData). The error number might help narrow in on the root cause.

And of course if you have any clue what might be different about the two systems on which this fails - something to do with how your login is set up, perhaps - add that information.
Comment 2 laurin1 2010-04-08 04:19:06 UTC
Should I be using -J-Dorg.netbeans.modules.keyring.level=0 again in this test?
Comment 3 Jesse Glick 2010-04-08 12:42:18 UTC
Yes please.

(Logging for the keyring is quiet by default to avoid polluting the log file when everything is running normally; as of recent dev builds, a one-line warning is printed in case the API must fall back to the master password implementation, instructing you how to turn on verbose logging, but that is it.)
Comment 4 laurin1 2010-04-08 13:18:16 UTC
INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Resolving dependencies took: 0 ms
INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Complete indexing of 0 binary roots took: 0 ms
INFO [org.netbeans.modules.subversion.client.SvnClientFactory]: running on javahl
INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Indexing of: nbfs://nbhost/SystemFileSystem/PHP/RuntimeLibraries/ took: 602 ms (New or modified files: 0, Deleted files: 0)
INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Complete indexing of 1 source roots took: 602 ms (New or modified files: 0, Deleted files: 0)
INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Resolving dependencies took: 16 ms
INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Complete indexing of 0 binary roots took: 0 ms
INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Indexing of: file:/C:/Program%20Files%20(x86)/NetBeans%20Dev/php/phpstubs/phpruntime/ took: 196 ms (New or modified files: 0, Deleted files: 0)
INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Indexing of: jar:file:/C:/Program%20Files%20(x86)/NetBeans%20Dev/ide/jsstubs/allstubs.zip!/ took: 953 ms (New or modified files: 1, Deleted files: 0)
INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Indexing of: file:/C:/inetpub/aadallas.org/ took: 2320 ms (New or modified files: 0, Deleted files: 11)
INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Complete indexing of 3 source roots took: 3469 ms (New or modified files: 1, Deleted files: 11)
INFO [org.netbeans.modules.subversion]: Finished indexing svn cache with 39 entries. Elapsed time: 2 ms.
FINEST [org.netbeans.modules.keyring]: reading: versioning.subversion.a1:72:aa:f9:45:e0:a5:cd:d9:8c:de:4e:40:5b:d7:03:ae:e6:26:4d
FINE [org.netbeans.modules.keyring.kde.KWalletProvider]: exception thrown while invoking the command "[qdbus, org.kde.kwalletd, /modules/kwalletd, org.kde.KWallet.isEnabled]"
java.io.IOException: CreateProcess error=2, The system cannot find the file specified
	at java.lang.ProcessImpl.create(Native Method)
	at java.lang.ProcessImpl.<init>(Unknown Source)
	at java.lang.ProcessImpl.start(Unknown Source)
Caused: java.io.IOException: Cannot run program "qdbus": CreateProcess error=2, The system cannot find the file specified
	at java.lang.ProcessBuilder.start(Unknown Source)
	at java.lang.Runtime.exec(Unknown Source)
	at java.lang.Runtime.exec(Unknown Source)
	at org.netbeans.modules.keyring.kde.KWalletProvider.runCommand(KWalletProvider.java:148)
	at org.netbeans.modules.keyring.kde.KWalletProvider.enabled(KWalletProvider.java:70)
	at org.netbeans.api.keyring.Keyring.provider(Keyring.java:67)
	at org.netbeans.api.keyring.Keyring.read(Keyring.java:88)
	at org.netbeans.modules.versioning.util.KeyringSupport.read(KeyringSupport.java:77)
	at org.netbeans.modules.subversion.SvnModuleConfig.getRecentUrls(SvnModuleConfig.java:261)
	at org.netbeans.modules.subversion.SvnModuleConfig.getRepositoryConnectionIntern(SvnModuleConfig.java:450)
	at org.netbeans.modules.subversion.SvnModuleConfig.getRepositoryConnection(SvnModuleConfig.java:196)
	at org.netbeans.modules.subversion.Subversion.getClient(Subversion.java:242)
	at org.netbeans.modules.subversion.Subversion.getClient(Subversion.java:275)
	at org.netbeans.modules.subversion.Subversion.getClient(Subversion.java:268)
	at org.netbeans.modules.subversion.VersionsCache.getBaseRevisionFile(VersionsCache.java:210)
	at org.netbeans.modules.subversion.Subversion.getOriginalFile(Subversion.java:566)
	at org.netbeans.modules.subversion.SubversionVCS.getOriginalFile(SubversionVCS.java:155)
	at org.netbeans.modules.versioning.diff.DiffSidebar.checkoutOriginalFiles(DiffSidebar.java:948)
	at org.netbeans.modules.versioning.diff.DiffSidebar.getText(DiffSidebar.java:874)
	at org.netbeans.modules.versioning.diff.DiffSidebar.access$1200(DiffSidebar.java:99)
	at org.netbeans.modules.versioning.diff.DiffSidebar$RefreshDiffTask.fetchOriginalContent(DiffSidebar.java:841)
	at org.netbeans.modules.versioning.diff.DiffSidebar$RefreshDiffTask.computeDiff(DiffSidebar.java:812)
	at org.netbeans.modules.versioning.diff.DiffSidebar$RefreshDiffTask.run(DiffSidebar.java:802)
	at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1369)
[catch] at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:1907)
FINE [org.netbeans.modules.keyring.gnome.GnomeProvider]: no GNOME_KEYRING_* environment variable set
FINE [org.netbeans.modules.keyring.fallback.FallbackProvider]: Using provider: org.netbeans.modules.keyring.win32.Win32Protect@282a2
FINE [org.netbeans.modules.keyring.Utils]: chmod go-r C:\Users\keithdavis\.netbeans\dev\config\Preferences\org\netbeans\modules\keyring\win32.properties
FINE [org.netbeans.modules.keyring.fallback.FallbackProvider]: failed to decrypt sample key
java.lang.Exception: CryptUnprotectData failed: -2146893813
	at org.netbeans.modules.keyring.win32.Win32Protect.decrypt(Win32Protect.java:110)
	at org.netbeans.modules.keyring.fallback.FallbackProvider.testSampleKey(FallbackProvider.java:97)
	at org.netbeans.modules.keyring.fallback.FallbackProvider.enabled(FallbackProvider.java:77)
	at org.netbeans.api.keyring.Keyring.provider(Keyring.java:67)
	at org.netbeans.api.keyring.Keyring.read(Keyring.java:88)
	at org.netbeans.modules.versioning.util.KeyringSupport.read(KeyringSupport.java:77)
	at org.netbeans.modules.subversion.SvnModuleConfig.getRecentUrls(SvnModuleConfig.java:261)
	at org.netbeans.modules.subversion.SvnModuleConfig.getRepositoryConnectionIntern(SvnModuleConfig.java:450)
	at org.netbeans.modules.subversion.SvnModuleConfig.getRepositoryConnection(SvnModuleConfig.java:196)
	at org.netbeans.modules.subversion.Subversion.getClient(Subversion.java:242)
	at org.netbeans.modules.subversion.Subversion.getClient(Subversion.java:275)
	at org.netbeans.modules.subversion.Subversion.getClient(Subversion.java:268)
	at org.netbeans.modules.subversion.VersionsCache.getBaseRevisionFile(VersionsCache.java:210)
	at org.netbeans.modules.subversion.Subversion.getOriginalFile(Subversion.java:566)
	at org.netbeans.modules.subversion.SubversionVCS.getOriginalFile(SubversionVCS.java:155)
	at org.netbeans.modules.versioning.diff.DiffSidebar.checkoutOriginalFiles(DiffSidebar.java:948)
	at org.netbeans.modules.versioning.diff.DiffSidebar.getText(DiffSidebar.java:874)
	at org.netbeans.modules.versioning.diff.DiffSidebar.access$1200(DiffSidebar.java:99)
	at org.netbeans.modules.versioning.diff.DiffSidebar$RefreshDiffTask.fetchOriginalContent(DiffSidebar.java:841)
	at org.netbeans.modules.versioning.diff.DiffSidebar$RefreshDiffTask.computeDiff(DiffSidebar.java:812)
	at org.netbeans.modules.versioning.diff.DiffSidebar$RefreshDiffTask.run(DiffSidebar.java:802)
	at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1369)
[catch] at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:1907)
FINE [org.netbeans.modules.keyring.fallback.FallbackProvider]: sample key decryption failed and are not retrying
FINE [org.netbeans.modules.keyring.Utils]: chmod go-r C:\Users\keithdavis\.netbeans\dev\config\Preferences\org\netbeans\modules\keyring.properties
WARNING [org.netbeans.modules.keyring.fallback.MasterPasswordEncryption]: Falling back to master password encryption; add -J-Dorg.netbeans.modules.keyring.level=0 to netbeans.conf to see why native keyrings could not be loaded
FINE [org.netbeans.modules.keyring.fallback.FallbackProvider]: Using provider: org.netbeans.modules.keyring.fallback.MasterPasswordEncryption@390afb
FINE [org.netbeans.modules.keyring.Utils]: chmod go-r C:\Users\keithdavis\.netbeans\dev\config\Preferences\org\netbeans\modules\keyring\general.properties
FINE [org.netbeans.modules.keyring.fallback.MasterPasswordEncryption]: cancelled master password dialog
FINE [org.netbeans.modules.keyring.fallback.FallbackProvider]: failed to decrypt sample key
java.lang.Exception: cannot unlock
	at org.netbeans.modules.keyring.fallback.MasterPasswordEncryption.decrypt(MasterPasswordEncryption.java:119)
	at org.netbeans.modules.keyring.fallback.FallbackProvider.testSampleKey(FallbackProvider.java:97)
	at org.netbeans.modules.keyring.fallback.FallbackProvider.enabled(FallbackProvider.java:77)
	at org.netbeans.api.keyring.Keyring.provider(Keyring.java:67)
	at org.netbeans.api.keyring.Keyring.read(Keyring.java:88)
	at org.netbeans.modules.versioning.util.KeyringSupport.read(KeyringSupport.java:77)
	at org.netbeans.modules.subversion.SvnModuleConfig.getRecentUrls(SvnModuleConfig.java:261)
	at org.netbeans.modules.subversion.SvnModuleConfig.getRepositoryConnectionIntern(SvnModuleConfig.java:450)
	at org.netbeans.modules.subversion.SvnModuleConfig.getRepositoryConnection(SvnModuleConfig.java:196)
	at org.netbeans.modules.subversion.Subversion.getClient(Subversion.java:242)
	at org.netbeans.modules.subversion.Subversion.getClient(Subversion.java:275)
	at org.netbeans.modules.subversion.Subversion.getClient(Subversion.java:268)
	at org.netbeans.modules.subversion.VersionsCache.getBaseRevisionFile(VersionsCache.java:210)
	at org.netbeans.modules.subversion.Subversion.getOriginalFile(Subversion.java:566)
	at org.netbeans.modules.subversion.SubversionVCS.getOriginalFile(SubversionVCS.java:155)
	at org.netbeans.modules.versioning.diff.DiffSidebar.checkoutOriginalFiles(DiffSidebar.java:948)
	at org.netbeans.modules.versioning.diff.DiffSidebar.getText(DiffSidebar.java:874)
	at org.netbeans.modules.versioning.diff.DiffSidebar.access$1200(DiffSidebar.java:99)
	at org.netbeans.modules.versioning.diff.DiffSidebar$RefreshDiffTask.fetchOriginalContent(DiffSidebar.java:841)
	at org.netbeans.modules.versioning.diff.DiffSidebar$RefreshDiffTask.computeDiff(DiffSidebar.java:812)
	at org.netbeans.modules.versioning.diff.DiffSidebar$RefreshDiffTask.run(DiffSidebar.java:802)
	at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1369)
[catch] at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:1907)
FINE [org.netbeans.modules.keyring.fallback.MasterPasswordEncryption]: cancelled master password dialog
FINE [org.netbeans.modules.keyring.fallback.FallbackProvider]: sample key decryption failed and are not retrying
FINE [org.netbeans.modules.keyring.fallback.FallbackProvider]: No provider
FINE [org.netbeans.modules.keyring]: Using provider: org.netbeans.api.keyring.Keyring$DummyKeyringProvider@956567
FINEST [org.netbeans.modules.keyring]: reading: versioning.subversion.cert.a1:72:aa:f9:45:e0:a5:cd:d9:8c:de:4e:40:5b:d7:03:ae:e6:26:4d
FINEST [org.netbeans.modules.keyring]: reading: versioning.subversion.2e:d1:92:a1:75:a7:21:42:eb:bb:0d:dc:63:bb:4a:bd:93:d4:30:be
FINEST [org.netbeans.modules.keyring]: reading: versioning.subversion.cert.2e:d1:92:a1:75:a7:21:42:eb:bb:0d:dc:63:bb:4a:bd:93:d4:30:be
FINEST [org.netbeans.modules.keyring]: reading: versioning.subversion.a1:72:aa:f9:45:e0:a5:cd:d9:8c:de:4e:40:5b:d7:03:ae:e6:26:4d
FINEST [org.netbeans.modules.keyring]: reading: versioning.subversion.cert.a1:72:aa:f9:45:e0:a5:cd:d9:8c:de:4e:40:5b:d7:03:ae:e6:26:4d
FINEST [org.netbeans.modules.keyring]: reading: versioning.subversion.2e:d1:92:a1:75:a7:21:42:eb:bb:0d:dc:63:bb:4a:bd:93:d4:30:be
FINEST [org.netbeans.modules.keyring]: reading: versioning.subversion.cert.2e:d1:92:a1:75:a7:21:42:eb:bb:0d:dc:63:bb:4a:bd:93:d4:30:be
Comment 5 Jesse Glick 2010-04-08 13:55:26 UTC
"Key not valid for use in specified state." according to Googling "CryptUnprotectData 2146893813". Not sure exactly what causes this, but likely related to a recent change in passwords, using the same NetBeans user directory from different user accounts, or a Windows upgrade. Try shutting down the IDE, deleting

C:\Users\keithdavis\.netbeans\dev\config\Preferences\org\netbeans\modules\keyring.properties
C:\Users\keithdavis\.netbeans\dev\config\Preferences\org\netbeans\modules\keyring\win32.properties

and start again. If this fixes the problem, then I can try to make NB do something like this automatically. Obviously if you can figure out how to reproduce the problem, that would be very helpful.

(The root problem is that Windows has no true keyring, just a way to encrypt passwords with the login, so NetBeans has to manage the storage. This means that if the encryption key is changed or damaged, NetBeans just gets an error message. On, say, Mac OS X with its Keychain, the application can just ask for a password by name, and it is up to the OS to make sure the keyring is unlocked and in a consistent state.)
Comment 6 Jesse Glick 2010-04-08 14:40:49 UTC
By the way I was unable to reproduce in XP just by changing my account password and logging in with the new password - previously stored NB passwords were still read correctly.
Comment 7 laurin1 2010-04-08 16:25:52 UTC
That worked. I deleted those files, opened NB, added the passwords back to the projects and no Master Password box. 

FYI, I've changed the passwords on all three machines and only one machine did not this problem. Now, the two machines that have this problem are not on my domain most of the time (joined, but one is a laptop and the other is my home PC that connects via VPN.) That is the only difference that I can think of. Weird.
Comment 8 Quality Engineering 2010-04-09 04:49:53 UTC
Integrated into 'main-golden', will be available in build *201004090201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/55904b374827
User: Jesse Glick <jglick@netbeans.org>
Log: Diagnostics for #183618.
Comment 9 Jesse Glick 2010-04-12 20:49:13 UTC
Still do not know what causes this, so cannot really consider to be fixed, but in core-main #63255a322a36 I have tried to add another dialog: if decryption of a sample key fails (as in your case), you will be prompted to delete your existing password storage and start again with a blank keyring. It seems that this will suffice to recover.
Comment 10 Quality Engineering 2010-04-13 17:38:01 UTC
Integrated into 'main-golden', will be available in build *201004131450* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/63255a322a36
User: Jesse Glick <jglick@netbeans.org>
Log: Ability to recover from encryption problems such as in #183618 through GUI.


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo