SQL 2005 RS Configuration Tool - Encryption Key Error

Mar 9, 2007

I have SQL 2005, and Reporting Service has been uninstalled and reinstalled,
go through each step of confiugration until Encryption Key, for some reason,
the backup button is grayed out, only "restore" button is clickable, as well
as Delete, but we never backup the key before, so this is really strange
since we do not have backupkey, so we cannot restore.

we tried "Delete", then we got the following error:

ReportServicesConfigUI.WMIProvider.WMIProviderException: The encrypted
value for the "LogonCred" configuration setting cannot be decrypted.
(rsFailedToDecryptConfigInformation)
at
ReportServicesConfigUI.WMIProvider.RSReportServerAdmin.ThrowOnError(ManagementBaseObject mo)
at
ReportServicesConfigUI.WMIProvider.RSReportServerAdmin.DeleteEncryptedInformation()

Browse report manager and reportserver also got the same error, run
rskeymgmt -d, does not help either

Any suggestion?

Thanks
Don

View 10 Replies


ADVERTISEMENT

Error Received In Sql Server Reporting Services Configuration Tool When Changing Encryption Key.

Nov 6, 2007

I've SQL Server Reporting Services 2005 configured on my system, but now I'm NOT Able to start the report server. I get this error on http://<serverurl>/Reports/Home.aspx:

The report server cannot decrypt the symmetric key used to access sensitive or encrypted data in a report server database. You must either restore a backup key or delete all encrypted content. Check the documentation for more information. (rsReportServerDisabled) (rsRPCError) Get Online Help

The report server cannot decrypt the symmetric key used to access sensitive or encrypted data in a report server database. You must either restore a backup key or delete all encrypted content. Check the documentation for more information. (rsReportServerDisabled)
Key not valid for use in specified state. (Exception from HRESULT: 0x8009000B)

I don't want to loose any data. Please help me resolving this error.

FYI, I've modified the SQL Reporting Services account LogOnAs info, in Properties of "SQL Server Reporting Services (MSSQLSERVER)" Service, in Windows Service Managment.

Earlier I had .useraccount as username, I modified it to domainnameuseraccount. And then suddenlt everything broke for reporting server.

View 4 Replies View Related

Cannot Connect To SQL Server 2005 DB From ASP.NET Configuration Tool

Sep 25, 2006

Hello,I am trying to connect to a DB, which is hosted on an SQL Server 2005 by a provider, using ASP.NET Configuration Tool. The result is the following error when I click on the Security Tab:---There is a problem with your selected data store. This can be caused by an invalid server name or credentials, or by insufficient permission. It can also be caused by the role manager feature not being enabled. Click the button below to be redirected to a page where you can choose a new data store. The following message may help in diagnosing the problem: An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) ---The hosting provider checked that my connection string is correct. They do not know why I get the error, though. Here is a relevant snippet from my web.config:<connectionStrings> <remove name="LocalSqlServer" /> <add name="LocalSqlServer"connectionString="Data Source=ABC;Integrated Security=false;Initial Catalog=ABC;User ID=ABC;Password=ABC"providerName="System.Data.SqlClient" /></connectionStrings>ABC is a mock :)Could anyone pls help? It is much appreciated.

View 4 Replies View Related

Error Trying To Open Reporting Configuration Tool

Aug 3, 2007

I just installed SQL Server 2005 Express Edition and reporting services (followed the video tutorial). Whenever I try to open the Reporting Configuration Tool, it gives me the following error:

SQL Server 2005 Reporting Configuration Tool has encountered a problem and needs to close. We are sorry for the inconvience.

My only options are to Debug or Close.

I'm not sure why I am getting this error. Can anyone help?

Thanks,
Amanda

View 9 Replies View Related

ASP.NET Configuration Tool

Apr 4, 2008

Hi Guys
Got this problem, ive setup some new roles and users through asp.net configuration and it creates ASPNETDB.MDF in the App_Data folder when ive got a DB in SQL server 2005 express.
Basically how do i change it so the tables created for the users and roles are created in the SQL Server 2005 Db? p.s I'm very new to sql server 2005
Thanks

View 5 Replies View Related

Configuration Tool

May 17, 2007

In SSRS 2005, where do I find Reporting Services Configuration tool ?
Thanks

View 1 Replies View Related

Asp.net Configuration Tool

Jul 22, 2006

I deployed a web site, and converted SQL Server Express to a single SQL Server 2005 database. I created all of the tables required for memberships and roles with aspnet_regsql.exe.

Real simple question - how can I populate the membership and role tables out on the server? When I attach VWD to it, the ASP.NET Configuration tool is gone. How do you maintain memberships and roles without the tool?

Thanks for any help you will share :)

It's been a long journey but I am finally here!

View 5 Replies View Related

Configuration Management Tool

Dec 19, 2007

Dear All,
Where to find configuration management tool in sql server 2005???

Vinod
Even you learn 1%, Learn it with 100% confidence.

View 4 Replies View Related

Configuration Management Tool

Dec 19, 2007

Dear Experts,
where can i find configuration management tool

actually i'm trying to change my MSDB mode from suspect to normal...

Vinod
Even you learn 1%, Learn it with 100% confidence.

View 1 Replies View Related

Reporting Configuration Tool

Aug 29, 2007

I installed 2005 advance... install said all OK. I go to Reporting Configuration tool, try to set Report Server Virtual Directory,
set new to default... says number of errors 0 but the crashes with the "... and has to close" No details as to what the error is
and when I retry I cannot click on Report Manager Virtual Directory. Any Ideas?

View 1 Replies View Related

Only Configuration Tool Downloaded, Why?

Mar 22, 2007

Hi,

First of all, I am very new on SQL server express.

Today I downloaded and installed the SQL server express (from www.microsoft.com/downloads), but what I got is only: Configuration tool, (I can see from: Start -> Programms -> Microsoft SQL server 2005->Configuration tool).

I didn't get SQL Server management Studio express, SAL Server Business Intelligence Development Studio, and Documentation and Tutorials.

I don't know where I did wrong, please help.

Thank you.

James

View 1 Replies View Related

SQL Security :: Encryption 2005 - User Defined Function For Encryption And Decryption

Oct 7, 2015

I have created two user defined functions for encryption and decryption using passphrase mechanism. When I call encryption function, each time I am getting the different values for the same input. While I searching a particular value, it takes long time to retrieve due to calling decryption function for each row.

best way to encrypt and decrypt using user defined functions.Below is the query which is taking long time.

SELECT ID FROM table WITH (NOLOCK)
                     WHERE dbo.DecodeFunction(column) = 'value'

When I try to use symetric or asymetric encryption, I am not able to put "OPEN SYMETRIC KEY" code in a function. So, I am using PassPhrase mechanism.

View 3 Replies View Related

Reporting Services Configuration Tool

Jul 11, 2007

Hello all

I am trying to configure reporting services using the Configuration Tool. I get all checks green except for Encryption Keys (Blue), Initialization (Grey), and Email Settings and Execution Account (both Yellow). I am not too worried about the yellow and blue ones because I have read that other people have the same, but I was wondering how to make Initialization available to configure. I am running SQL Server 2005 - Standard Edition.

Thanks for the help,



S.R.

View 39 Replies View Related

Reporting Services Configuration Tool

Jul 12, 2007

we just got the new server windows 2003 server, sql server 2005

- i use remote desktop connect to the server.

- i made the report services for testing,

the problem is I can't not published report.

i check the report services configuration tool.

(the page is gray. also warning come "no report server were found on
the specified machine" detail invalid namespace)

what shoul i do?

View 2 Replies View Related

Force Protocol Encryption In SQL2005 Client Configuration Doesn't...

Feb 5, 2007

I am accessing a SQL2005 Express SP1 Server via TCP/IP (all machines fully up to date with windows update). For ease of configuration the Server IP is mapped to an Alias in Native Client Configuration Manager. On the Client Force Protocol Encryption is set to Yes and Trust Server Certificate is set to No. The clients are accessing the DB via SQL 2005 Management studio express and Ms Access 2003 (an access adp front end to the sql database).

As a test i turned off force encryption on the server. A Network trace shows no encryption! Turning on force encryption on the server corrects this.

As a further test I configured the server with a certificate the client doesn't trust. No error is generated by the un-trusted certificate! The only way to generate the certificate error is to enable encryption in the connection properties of each application. Why isn't the Native Client Configuration Manager utility enforcing this???

This brings me on to a second (off-topic problem). In my access adp file, if I enable €œuse encryption for data€? advanced option under the database connection dialog all works as expected (encryption + certificate verification). However, I am programmatically updating the connection in VBA

Application.CurrentProject.OpenConnection "Provider=SQLOLEDB.1;Data Source=AliasName;Use Encryption for Data=True;..."

If I do this no encryption is enabled!!! Access seems to just ignore the encryption statement.

Has anybody got any ideas as to why either of these issues are occurring or if there are any workarounds?

Thanks

Stuart



View 3 Replies View Related

I Wrote My Own Configuration Tool To Maintain The Connection Strings In A SQL Table

Mar 29, 2006

I wrote my own VB app to maintain all of my connection strings and link them to packages. I then grab them at run time and set them as variables in memory.

View 1 Replies View Related

SQL 2005 Install Error - WMI Configuration

Jun 28, 2006

I'm getting an error when the SQL install program checks the system - "The SQL Server System Configuration Checker cannot be executed due to WMI configuration on the machine DI-ERP2 Error:2148007941 (0x80080005).



I've tried a bunch of stuff as suggested by some of the other threads, but nothing is working so far...



Any ideas would be greatly appreciated.

View 7 Replies View Related

SQL 2005 - Reporting Services Configuration Error.. Pls Help..

Aug 12, 2007

Hi,

I've installed SQL 2005 on a Windows 2003 R2 Server, I also installed another Web Server (Another Windows 2003 R2 Server) on a different machine.
I've installed the Reporting Services on the Web Server.
When I am trying to configure the report server, I successfully created the Virtual Directories, but when trying to do the "Database Setup" step, I am getting an error on the "Create a Grants Rights Script", with this message:

System.UnauthorizedAccessException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at System.Management.ManagementScope.InitializeGuts(Object o)
at System.Management.ManagementScope.Initialize()
at System.Management.ManagementObjectSearcher.Initialize()
at System.Management.ManagementObjectSearcher.Get()
at Microsoft.ReportingServices.Diagnostics.WebUtil.GetIPAddresses(String machine)
at ReportServicesConfigUI.Panels.DatabaseSetupPanel.IsLocalDbServer(String dbServer)
at ReportServicesConfigUI.Panels.DatabaseSetupPanel.SetDatabaseConnectionTask(String connectionString, String server, String database, ConfigurationCredentialsType credsType, String account, String password, Boolean upgrade, String dbVersion)


As a result, I cannot run the reports nor get to the folder.aspx page on the manager side of the application.
I am getting this HTML msg:
The report server installation is not initialized. (rsReportServerNotActivated) (rsRPCError) Get Online Help

When installing the Reporing Server on the SQL Server machine, it works with no problems, and I am doing everything the same.

Would appreciate your help, I've been working on this for few days with no luck.

Thank you!
Yaniv.

View 4 Replies View Related

10080 Sql Server 2005 Configuration Caused Error?

Jan 30, 2007

Hi.I have an ancient preCambrian app that uses the db library to interface withsql server databases.It is written in c++.When testing it I noticed on one machine with sql server 2005 installed itruns fine, but on another it has some problems, notably.. it gets as a resultof a select statement with an order by clause the error:only fully keyset ddriven cursors can have 'order by', 'group by', or 'having'phrases.Error code 10080Can someone suggest a 'configuration' parameter that might be causing theotherwise identical systems to have this problem on one machine and not theother?ThanksJeffthanksJeffJeff Kish

View 1 Replies View Related

Error During First Configuration After Installing Reporting Services (SQL Server 2005 Express)

Jan 27, 2008

Hi,

I have problem during first configuration of Reporting Services from MS SQL 2005 Server Express with Advanced Services SP2. The error occurs when configuring virtual directory (Reporting Services Configuration Manager -> Report Server Virtual Directory). When I try to create new virtual directory I can see following messages:

Number of errors: 0
Create Virtual Directory

The virtual directory was created and assigned.
Changing Secure Connection Level


After last message Windows reports that SQL Server 2005 Reporting Configuration Tool has encountered a problem and needs to close (and I can send report to Microsoft).

IIS shows that virtual directory under default web site was created.

Evenet viewer (application log) shows .NET Framework 2.0 error:
EventType clr20r3, P1 rsconfigtool.exe, P2 9.0.3042.0, P3 45cd6ee2, P4 rsconfigtool, P5 9.0.242.0, P6 45cd6ee2, P7 15a, P8 5, P9 system.nullreferenceexception, P10 NIL


My environment:
MS SQL Reporting Services Version 9.00.3042.00
Windows XP Proffessional SP2
IIS 5.1
all components are fresh new installations. The only additional configuration I've made was adding IWAM_<hostname> as WebServiceAccount, all other configuration is default.

Any help would be appreciated.

Best regards
Slawomir Nasiadka


View 2 Replies View Related

SQL 2005 Express Setup Issue (The SQL Server System Configuration Checker Cannot Be Executed Due To WMI Configuration )

Sep 22, 2007

I am getting following error when trying to install SQL express 2005 on XPSP2.


TITLE: Microsoft SQL Server 2005 Setup
------------------------------

The SQL Server System Configuration Checker cannot be executed due to WMI configuration on the machine SIGMA-805539A79 Error:2147944122 (0x800706ba).

For help, click: http://go.microsoft.com/fwlink?LinkID=20476&ProdName=Microsoft+SQL+Server&ProdVer=9.00.1399.06&EvtSrc=setup.rll&EvtID=70342


I tied re-installing WMI using http://blogs.msdn.com/jpapiez/archive/2004/12/09/279041.aspx link but could not get it working.


Do i need IIS installed? Its not installed on this box...

please suggest something... i am stuck...

Thanks,

View 3 Replies View Related

Call Vb.Net Developed Dll In SQL Server 2005 With Configuration Level 80 Then Gets Error Invalid Class String

Jul 14, 2006

Hi,
I want to call a dll from Stored procedure developed in SQL Server 2005 at configuration level 80. but when I execute the stored procedure I get the following error.

Error Source: ODSOLE Extended Procedure
Description: Invalid class string

Code of stored procedure and vb.net class is given below:

VB.Net
Imports System
Imports System.IO
Imports System.Data
Imports System.Data.SqlClient
Imports System.Data.SqlTypes
Imports Microsoft.SqlServer.Server
Imports Microsoft.VisualBasic
Imports System.Diagnostics

Public Class PositivePay

Public Shared Sub LogToTextFile(ByVal LogName As String, ByVal newMessage As String)
' impersonate the calling user
Dim newContext As System.Security.Principal.WindowsImpersonationContext
newContext = SqlContext.WindowsIdentity.Impersonate()
Try
Dim w As StreamWriter = File.AppendText(LogName)
LogIt(newMessage, w)
w.Close()
Catch Ex As Exception

Finally
newContext.Undo()
End Try
End Sub
End Class
===============================================================

STORED PROCEDURE
Create PROCEDURE [dbo].[PPGenerateFile]
AS

BEGIN
Declare @retVal INT
Declare @comHandler INT
declare @errorSource nvarchar(500)
declare @errorDescription nvarchar(500)
declare @retString nvarchar(100)

-- Intialize the COM component
EXEC @retVal = sp_OACreate 'PositivePay.class', @comHandler OUTPUT
IF(@retVal <> 0)
BEGIN
--Trap errors if any
EXEC sp_OAGetErrorInfo @comHandler,@errorSource OUTPUT, @errorDescription OUTPUT
SELECT [error source] = @errorsource, [Description] = @errordescription
Return
END

-- Call a method into the component
EXEC @retVal = sp_OAMethod @comHandler,'LogToTextFile',@retString OUTPUT, @LogName = 'D: ext.txt',@newMessage='Hello'
IF (@retVal <>0 )
BEGIN
EXEC sp_OAGetErrorInfo @comHandler,@errorSource OUTPUT, @errorDescription OUTPUT
SELECT [error source] = @errorsource, [Description] = @errordescription
Return
END
select @retString

END

View 6 Replies View Related

Reporting Services :: Cannot Click Restore Button In RS Configuration Manager To Restore Encryption Key

Oct 29, 2015

While migrating Report services in SQL Server 2005 to 2014, I am trying to restore the Encryption Key in RS Configuration Manager in2014. But I cannot click the 'Restore' button in RS Configuration Manager. So if I should be grant more right to do so or any other action?

View 2 Replies View Related

SQL Server Standard 2005, SQL Mobile 2005 Data Encryption Issues

Jul 26, 2007

Hi,

I have a central database server that is runnning on SQL 2005 standard edition and Windows server 2003 standard as OS.

I realise that I can use SQL statements to encrypt and decrypt the data inside the standard SQL.

However, how do I read and write the data via an web application coded in C#.net and is also running on the same machine?

Another issue is, I need to replicate some of the data in this SQL standard over to a SQL mobile running on a mobile device running on Windows CE 5.0.

The mobile device also needs to read and write data to the encrypted data via a C#.net application.

Question is, with all these requirements to be met, can I use AES? I know that AES is not available on Windows XP and Windows Server 2000 and I cant find AES in the .net compact framework.

how do i go about ensuring security? how do I ensure that the symmetric key is the same both on the SQL standard and SQL mobile?

thank you.

View 7 Replies View Related

SQLServer Error: 22046, Encryption Error Using CryptProtectData

May 3, 2007

I created a ransactional publication.

Starting the LogReader Agent produce the error
'Unable to start execution of step 2 (reason: Error authenticating proxy NETRTLSRVSvcSQLLogReader, system error: Logon failure: unknown user name or bad password.). The step failed.'


This is the result of the SQL Agent Error
[298] SQLServer Error: 22046, Encryption error using CryptProtectData. [SQLSTATE 42000]


We are running SQL Server 2005 - 9.00.3042.00 (Intel X86) in a cluster environment.


If I change the Step 2 of the Agent Job (Type=Replication Transactional-Log Reader) to "Run AS" SQL Agent Service Account , everthing works fine.

There seems to be a problem with the access to the generated proxy/credential

Why it doesn't work with the special SvcSQLLogReader domain Login ?

View 6 Replies View Related

Encryption In SQL 2005

Apr 30, 2008

Does SQL Server 2005 not have a built in encryption function. I'm trying to INSERT and store passwords as an encrypted value in my table. Any help appreciated. Thanks.

View 1 Replies View Related

SQL 2005 Encryption

Feb 8, 2008

I have a VB 6 app with a SQL 2000 database backend.

To meet company standards I need to add encryption from the VB6 app to the database. I also need to add better password protection at the database. Upgrading to SQL 2005 will help with the password protection changes I need to make and I have been told that 2005 does have some sort of Encryption built in?

Does anybody have any references or information about encrypting data in transent between a VB6 app and SQL server 2005?

Thanks

View 1 Replies View Related

SQL 2005 Encryption And C#

Nov 6, 2007

Hi everyone. I'm relatively new to the world of encryption and have a specific scenario on which I need guidance.



Scenario / Requirments:



1) Our DBA group is loading a table with SSN from Oracle into SQL 2005. They will be encrypting the SSN using the built in encryption functionality of SQL. Specifically, they are using a SQL generated Certificate. (create cert dboCert ... encryptBycert ...)



This is their preferred method of encrypting the data but they are willing to change it if I need them to. Our only requirement is that it is at least 128 bit- 256 is preferred.



2) I am returning information back to a C# class. I don't want to use the DecryptByCert function in SQL and then send the clear text across the wire between SQL and the Web server, so I need to return the data as cipher text and then decrypt it on the web server in C#.



3) I will be logging queries into another table for auditing, so I will need to re-encrypt the SSN into this new table.



It is not required, but would be ideal if I can use the same algorithm to encrypt this new table as SQL uses in the encryptByCert. This way the DBA team can decrypt both tables without using my C# code should the need arise.



How do I do this? I've figured out how to use AES in the Security.Cryptography namespace, but I've read that although symmetric encryption is much faster, it is not ideal to use in a distributed system due to key management. I€™m also not clear how to use this in SQL (not sure it matters if it€™s not the best way to go).



I'm about to start researching the Security. Cryptography namespace for asymmetic encryption using certificates, but I'm not sure how that works with the SQL Certs (are the RSA?, etc).



At this point, I'm on information overload and my head is spinning. J




Thank you,

Tom Hundley

View 4 Replies View Related

Encryption SQL 2005

Jul 19, 2007

I have a desire to encrypt an entire database rather than utilizing TSQL to encrypt individual columns. Outside the SQL Server authentication and access should function as normal.



Reason: avoid customization and change to a vendor applicaiton, and satisfying the group security ghouls by being able to state definatively that the data within the database is encrypted.



The database is small as it contains only financial statement data, so performance should not be an issue.

View 1 Replies View Related

Encryption Using MS SQL 2005

Mar 16, 2007

Hello,

I have a application server with about 500,000 users. We are trying to tacle the issue of encryption. We are using MS SQL 2005 and I am sure that symmetric encryption would be the best, due to speed. But heres the kicker.....We want the whole database encrypted at rest, and when clients log onto our ASP to gain access to their programms the data must be in plain text. Any sugesstions?

Thanks,

Corliss

View 10 Replies View Related

DTS Encryption Error .. Bah !

May 29, 2001

Hi,

I have created a DTS package on my SQL 7.0 SP3 server which simply reads a table on another SQL 7.0 server and populates a local table with the information that has been read.

Whenever I try to execute the DTS package (via Run or scheduling it) I get the following error:

-------------------------------------------------------------------------
... DTSRun: Executing... DTSRun OnStart: Delete from Table [AfterSalesAccessories].[dbo].[model_derivative] Step DTSRun OnError: Delete from Table [AfterSalesAccessories].[dbo].[model_derivative] Step, Error = -2147217887 (80040E21) Error string: The property 'Use Encryption for Data' is not supported. Error source: Microsoft Data Transformation Services (DTS) Package
-------------------------------------------------------------------------

I have not selected the encryption option and can't see what I'm doing wrong.
Has anybone else seen this ? I've looked on Technet but no joy.

Thanks,

Tim

View 2 Replies View Related

Encryption Error On DTS

Feb 23, 2001

Hi,

I've recently started to get the following error on DTS packages that have been newly written and have been scheduled to run:

DTSRun: Loading... DTSRun: Executing... DTSRun OnStart: DTSStep_DTSExecuteSQLTask_1 DTSRun OnError: DTSStep_DTSExecuteSQLTask_1, Error = -2147217887 (80040E21) Error string: The property 'Use Encryption for Data' is not supported.

No passwords have been used to save the paskages nor am I aware of setting any encryption options.

I'm running SQL server 7.0 Sp3.

Any ideas

Thanks

Rob Walker

View 2 Replies View Related

RSA Encryption In DLL Using SQL Server 2005

Jun 11, 2008

I am having a problem with some code I have in a DLL that is running in SQL Server 2005. I am trying to get some RSA encryption and decryption. The encrypt code runs in SAFE mode without a problem. The decrypt code gets and error:

Msg 6522, Level 16, State 1, Line 1
A .NET Framework error occurred during execution of user-defined routine or aggregate "March_CryptoDecrypt":
System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.KeyContainerPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
System.Security.SecurityException:
at System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet)
at System.Security.CodeAccessPermission.Demand()
at System.Security.Cryptography.RSACryptoServiceProvider.ImportParameters(RSAParameters parameters)
at System.Security.Cryptography.RSA.FromXmlString(String xmlString)
at Crypto.DoCrypto.Decrypt(String P_text, String P_privateKey)
at SQLServerCrypto.Decrypt(SqlString P_text, SqlString P_privateKey)

Here is the decrypt code:

static public string Decrypt(string P_text, string P_privateKey)
{
string retStr;
string encryptedBlock = "";
string localTextStr = P_text;
int numberOfBlocks;

RSACryptoServiceProvider rsaProvider = new RSACryptoServiceProvider();

rsaProvider.FromXmlString(P_privateKey);
Queue<string> encryptedBlocks = new Queue<string>();

while (localTextStr.Length != 0)
{
if (rsaProvider.KeySize == 1024)
{
encryptedBlock = localTextStr.Substring(0, localTextStr.IndexOf("=") + 1);
encryptedBlocks.Enqueue(encryptedBlock);
localTextStr = localTextStr.Remove(0, encryptedBlock.Length);
}
else
{
encryptedBlock = localTextStr.Substring(0, localTextStr.IndexOf("==") + 2);
encryptedBlocks.Enqueue(encryptedBlock);
localTextStr = localTextStr.Remove(0, encryptedBlock.Length);
}
}

encryptedBlocks.TrimExcess();
numberOfBlocks = encryptedBlocks.Count;
retStr = "";
for (int cnt = 1; cnt <= numberOfBlocks; cnt++)
{
encryptedBlock = encryptedBlocks.Dequeue();
retStr +=
ASCIIEncoding.ASCII.GetString(rsaProvider.Decrypt(
Convert.FromBase64String(encryptedBlock), false));
}

return (retStr);
}

Here is the encrypt code that works:

static public string Encrypt(string P_text, string P_publicKey)
{
string retStr;
RSACryptoServiceProvider rsaProvider = new RSACryptoServiceProvider();

rsaProvider.FromXmlString(P_publicKey);

int numberOfBlocks = (P_text.Length / 32) + 1;
char[] charArray = P_text.ToCharArray();
byte[][] byteBlockArray = new byte[numberOfBlocks][];
int incrementer = 0;
for (int cnt = 1; cnt <= numberOfBlocks; cnt++)
{
if (cnt == numberOfBlocks)
{
byteBlockArray[cnt - 1] =
ASCIIEncoding.ASCII.GetBytes(charArray, incrementer, charArray.Length - incrementer);
}
else
{
byteBlockArray[cnt - 1] =
ASCIIEncoding.ASCII.GetBytes(charArray, incrementer, 32);
incrementer += 32;
}
}

retStr = "";
for (int cnt = 0; cnt < byteBlockArray.Length; cnt++)
{
retStr += System.Convert.ToBase64String(
rsaProvider.Encrypt(byteBlockArray[cnt], false));
}

return (retStr);
}

I do not see why the encrypt can run is safe mode and the decrypt can not. Does anyone have any ideas?

Thank You,

David Demland

View 7 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved