Encrypting connectionStrings with CustomProvider

C

Chuck P

I am trying to encrypt the connectionStrings in Web.config with a
custom provider. Works great for me, anyone else tries it they get
errors. Note the error says "decrypt"


My statements I ran on the IIS server to create the key is:
aspnet_regiis -pz WebEncryptionKeys

aspnet_regiis -pc WebEncryptionKeys -exp

aspnet_regiis -px WebEncryptionKeys "%ALLUSERSPROFILE%\Application
Data\Microsoft\Crypto\RSA\MachineKeys\WebEncryptionKeys_Public.xml"
-pri

aspnet_regiis -pa "WebEncryptionKeys" "NT Authority\Network Service"

The statements I run on the workstation to complie and encrypt is:
aspnet_compiler -v %virtualPath% -p %sourcePath% -f
%destinationPath% -c -nologo

aspnet_regiis -pi "WebEncryptionKeys" "%PublicKeyNameLocation%"

aspnet_regiis -pef "connectionStrings" %destinationPath% -prov
"HrCustomProvider"


The Error Message is:
Encrypting configuration section...

Failed to decrypt using provider 'HrCustomProvider'. Error message
from the provider: Bad Data.

(\\myservername\wwwroot\CriticalSkills\web.config line 19)


The Web.config is:

<configProtectedData>
<providers>
<add name="HrCustomProvider"
keyContainerName="WebEncryptionKeys"
useMachineContainer="true"

type="System.Configuration.RsaProtectedConfigurationProvider,System.Configuration,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</providers>
</configProtectedData>


Any ideas on why I can do it and no one else can?
I gave server admin to another user and it still gave the same error.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,012
Latest member
RoxanneDzm

Latest Threads

Top