summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJay Mundrawala <jdmundrawala@gmail.com>2015-06-01 16:40:47 -0700
committerJay Mundrawala <jdmundrawala@gmail.com>2015-06-01 16:40:47 -0700
commit1162606a8d5f7be3a7af9526732fe8cb61f9c96b (patch)
tree6ebfa48e13479380db41b76d821e0dd7ce990212
parent22da6b42a02fcfd7e9d03f5f09828b7ddc569bb9 (diff)
downloadchef-jdm/pscred-winrm.tar.gz
Allow creation of secure strings over remoting/servicesjdm/pscred-winrm
The issue here is the user profile does not get loaded when running over winrm / as a service. This user profile is needed to use the DPAPI to encrypt the data for the current user. Should fix #3246
-rw-r--r--lib/chef/win32/crypto.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/chef/win32/crypto.rb b/lib/chef/win32/crypto.rb
index 79cf51b002..a047071b79 100644
--- a/lib/chef/win32/crypto.rb
+++ b/lib/chef/win32/crypto.rb
@@ -29,7 +29,7 @@ class Chef
def self.encrypt(str, &block)
data_blob = CRYPT_INTEGER_BLOB.new
- unless CryptProtectData(CRYPT_INTEGER_BLOB.new(str.to_wstring), nil, nil, nil, nil, 0, data_blob)
+ unless CryptProtectData(CRYPT_INTEGER_BLOB.new(str.to_wstring), nil, nil, nil, nil, CRYPTPROTECT_LOCAL_MACHINE, data_blob)
Chef::ReservedNames::Win32::Error.raise!
end
bytes = data_blob[:pbData].get_bytes(0, data_blob[:cbData])