473,406 Members | 2,352 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Encryption Error

I have developed a web app using DPAPI to encrypt a
connection string in the web.config file. The application
works perfectly on the development machine but when
deployed to the server when opening the app the following
wrror is generated:

Exception decrypting. Decryption failed. 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.Exception: Exception decrypting.
Decryption failed. 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:
[Exception: Exception decrypting. Decryption failed. Key
not valid for use in specified state.
]
DataProtection.DataProtector.Decrypt(Byte[] cipherText,
Byte[] optionalEntropy)
StatusTrack.welcomeForm.GetConnectionString() +130
StatusTrack.welcomeForm.CreateDataSource() +19
StatusTrack.welcomeForm.FillGrid() +665
StatusTrack.welcomeForm.Page_Load(Object sender,
EventArgs e) +170
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +731
Does anyone have an answer for this?

Thanks,

Dave
Nov 15 '05 #1
2 4177
DPAPI uses the currently logged in user as the key for the encryption. Your
development machine most likely uses a different user account then your
server, therefore the decryption key is different.

How did you encrypt the information? Did you encrypt it on your development
machine and then just copy the web.config to the server? You will probably
need to encrypt the content on the machine you are deploying it to.
"Dave Bailey" <an*******@discussions.microsoft.com> wrote in message
news:03****************************@phx.gbl...
I have developed a web app using DPAPI to encrypt a
connection string in the web.config file. The application
works perfectly on the development machine but when
deployed to the server when opening the app the following
wrror is generated:

Exception decrypting. Decryption failed. 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.Exception: Exception decrypting.
Decryption failed. 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:
[Exception: Exception decrypting. Decryption failed. Key
not valid for use in specified state.
]
DataProtection.DataProtector.Decrypt(Byte[] cipherText,
Byte[] optionalEntropy)
StatusTrack.welcomeForm.GetConnectionString() +130
StatusTrack.welcomeForm.CreateDataSource() +19
StatusTrack.welcomeForm.FillGrid() +665
StatusTrack.welcomeForm.Page_Load(Object sender,
EventArgs e) +170
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +731
Does anyone have an answer for this?

Thanks,

Dave

Nov 15 '05 #2
I figured the problem out. The encryption was using the
machine store so it needed to be encrypted on the server.
Thanks for the input,

Dave
-----Original Message-----
I did indeed encrypt the information on the development
machine and then deployed the app to the server. My
question now is how can I use it on the server as that is
where the app must run?

Thanks,

Dave

-----Original Message-----
DPAPI uses the currently logged in user as the key forthe encryption. Your
development machine most likely uses a different user

account then your
server, therefore the decryption key is different.

How did you encrypt the information? Did you encrypt it

on your development
machine and then just copy the web.config to the server?You will probably
need to encrypt the content on the machine you aredeploying it to.


"Dave Bailey" <an*******@discussions.microsoft.com>

wrotein message
news:03****************************@phx.gbl...
I have developed a web app using DPAPI to encrypt a
connection string in the web.config file. The

application works perfectly on the development machine but when
deployed to the server when opening the app thefollowing wrror is generated:

Exception decrypting. Decryption failed. Key not validfor 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 andwhere it originated in the code.

Exception Details: System.Exception: Exceptiondecrypting. Decryption failed. Key not valid for use in specified
state.

Source Error:

An unhandled exception was generated during theexecution 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:
[Exception: Exception decrypting. Decryption failed. Key not valid for use in specified state.
]
DataProtection.DataProtector.Decrypt(Byte[]cipherText, Byte[] optionalEntropy)
StatusTrack.welcomeForm.GetConnectionString() +130
StatusTrack.welcomeForm.CreateDataSource() +19
StatusTrack.welcomeForm.FillGrid() +665
StatusTrack.welcomeForm.Page_Load(Object sender,
EventArgs e) +170
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +731
Does anyone have an answer for this?

Thanks,

Dave

.

.

Nov 15 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: David | last post by:
Hope someone can help or have a free control. I am going to be passing data from a client computer to a server via a winsock control. I want to encrypt/decript the contents of the string that is...
4
by: Nithi Gurusamy | last post by:
I am facing this error after making changes to client configuration utility of SQL Server 2000: Description: An unhandled exception occurred during the execution of the current web request....
1
by: Cliff | last post by:
We are trying to connect to 3 different Oracle databases using MS Access as the front-end and ODBC as the connection. The problem that we are having is that 1 of the databases requires a...
7
by: helmut woess | last post by:
Hi, has anybody knowledge about the safetyness of encrypting stored procs in SQL-Server 2005 using WITH ENCRYPTION? Or can they be hacked with the same old tools which exists for SQL 2000? ...
11
by: John Williams | last post by:
I've written a simple program to do XOR encryption as my first foray into understanding how encryption works. The code compiles fine, however it segmentation faults on every run. using gdb to...
19
by: klenwell | last post by:
Another request for comments here. I'd like to accomplish something like the scheme outlined at this page here: http://tinyurl.com/3dtcdr In a nutshell, the form uses javascript to hash...
3
by: =?Utf-8?B?TG9yZW4=?= | last post by:
I’m trying to encrypt and decrypt a file in vb.net. I am using the TripleDESCryptoServiceProvider encryption found in System.Security.Cryptography. Below is the code for my Encrypt and Decrypt...
1
by: Robert Blass | last post by:
I am looking to get my feet wet with encryption. When I say encryption program I am talking about something to get me off to a quick start. Something very simple, far less than the 40+ bit...
0
jeffstl
by: jeffstl | last post by:
After enabling forced protocol encryption on SQL server there are a handful of crystal reports that have the following error when you try to run them Query Engine Error: '08S01:Communication link...
0
jeffstl
by: jeffstl | last post by:
After checking the box "Force Protocol Encryption" on SQL Server Network Utility there are several Crystal reports that begin to throw the following error when run Query Engine Error:...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.