I am trying to decrypt connection string in my app.config using customized Config Protection Provider named "MyConfigProtectionProvider". I don't have code for this Customized Config Provider as it is developed a long back, I have only DLL file. We changed our DB Username and Password. I want to decrypt my connection string in Web.Config
using this customized Config Protection Provider and change password to new password and encrypt it again
I have only app.config. So I renamed it to "web.config
". Then I added CODE I as shown below in my web.config
. I store key in my c drive and I need to give Key file path. "MyConfigProtectionProvider
" will encrypt it using this key.
We already have encrypted connection string as shown in CODE II. So I tried decrypting it using following command in cmd as Admin
aspnet_regiis.exe -pdf "connectionStrings" "C:\Users\Tejas\Documents\Email_Notification\LatestBatchJobStatus\BatchJobStatus\Batch_Job_Status"
-prov "MyConfigProtectionProvider"
CODE I:
<configProtectedData defaultProvider="MyProtectionConfigurationProvider">
<providers><add name="MyProtectionConfigurationProvider" type="MyProtectionConfigurationProvider,
MyProtectionConfigurationProvider, Version=1.0.0.0,Culture=neutral,
PublicKeyToken=#############, processorArchitecture=MSIL"keyFilePath="C:\Users\Tejas\Documents\Email_Notification\LatestBatchJobStatus\BatchJobStatus\Batch_Job_Status\ConnectionKey\ConnectionKey.txt" /></providers></configProtectedData>
CODE II:
<connectionStrings configProtectionProvider="MyProtectionConfigurationProvider"> <EncryptedData>7Zqa4I623WR..................</EncryptedData></connectionStrings>
I am getting following error "An error has occurred: 0X80070002 The System cannot find the file specified".
What is the mistake I made?
User contributions licensed under CC BY-SA 3.0