Decrypting Provided Data

May 2, 2007

I have following problem. I would like to provide to my STP encrypted data and decrypt them inside it. To decrypt the data I'd like to use DecryptByKey. Encryption should be made on the Win32/.NET client.



Unfortunately I cannot find the way to make the data understable between the both worlds. First how to assign the same key on the both side? Do I get the same key from




Code Snippet

create symmetric key MyKey with

algorithm=triple_des,

key_source='abrakadabra'

encryption by password='aaa'



and from




Code Snippet

string Key = "abrakadabra";

byte[] bKey = Encoding.ASCII.GetBytes(Key);

byte[] salt = new byte[8];



RNGCryptoServiceProvider rnd = new RNGCryptoServiceProvider();

rnd.GetBytes(salt);

PasswordDeriveBytes pdb = new PasswordDeriveBytes(bKey, salt);



TripleDESCryptoServiceProvider prov = new TripleDESCryptoServiceProvider();

prov.GenerateIV();

prov.Key = pdb.CryptDeriveKey("TripleDES", "SHA1", 168, prov.IV);

???

I have read somewhere that create symmetric key calls CryptDeriveKey, but I'm not sure.



The next point is the format of the output data. I have noted, that the output from EncryptByKey is 16 bytes longer (after stripping key guid and fixed 0x01000000) than the one from Win32/.NET application. I assume, that it can lie in the inserting of IV as the first block, but should not IV be only 64 bit long in the DES family of algorithms?



Neverthless I have not magaged to perform encrypted communication such way between SQL Server 2005 and client application. Is it possible at all?







View 1 Replies


ADVERTISEMENT

How To Remove Partially Duplicate Rows From Select Query's Result Set (DB Schema Provided And Query Provided).

Jan 28, 2008

Hi, 
Please help me with an SQL Query that fetches all the records from the three tables but a unique record for each forum and topicid with the maximum lastpostdate. I have to bind the result to a GridView.Please provide separate solutions for SqlServer2000/2005. 
I have three tables namely – Forums,Topics and Threads  in SQL Server2000 (scripts for table creation and insertion of test data given at the end). Now, I have formulated a query as below :- 
SELECT ALL f.forumid,t.topicid,t.name,th.author,th.lastpostdate,(select count(threadid) from threads where topicid=t.topicid) as NoOfThreads
FROM
Forums f FULL JOIN Topics t ON f.forumid=t.forumid
FULL JOIN Threads th ON t.topicid=th.topicid
GROUP BY t.topicid,f.forumid,t.name,th.author,th.lastpostdate
ORDER BY t.topicid ASC,th.lastpostdate DESC 
Whose result set is as below:- 




forumid
topicid
name
author
lastpostdate
NoOfThreads

1
1
Java Overall
x@y.com
2008-01-27 14:48:53.000
2

1
1
Java Overall
a@b.com
2008-01-27 14:44:29.000
2

1
2
JSP
NULL
NULL
0

1
3
EJB
NULL
NULL
0

1
4
Swings
p@q.com
2008-01-27 15:12:51.000
1

1
5
AWT
NULL
NULL
0

1
6
Web Services
NULL
NULL
0

1
7
JMS
NULL
NULL
0

1
8
XML,HTML
NULL
NULL
0

1
9
Javascript
NULL
NULL
0

2
10
Oracle
NULL
NULL
0

2
11
Sql Server
NULL
NULL
0

2
12
MySQL
NULL
NULL
0

3
13
CSS
NULL
NULL
0

3
14
FLASH/DHTLML
NULL
NULL
0

4
15
Best Practices
NULL
NULL
0

4
16
Longue
NULL
NULL
0

5
17
General
NULL
NULL
0  
On modifying the query to:- 
SELECT ALL f.forumid,t.topicid,t.name,th.author,th.lastpostdate,(select count(threadid) from threads where topicid=t.topicid) as NoOfThreads
FROM
Forums f FULL JOIN Topics t ON f.forumid=t.forumid
FULL JOIN Threads th ON t.topicid=th.topicid
GROUP BY t.topicid,f.forumid,t.name,th.author,th.lastpostdate
HAVING th.lastpostdate=(select max(lastpostdate)from threads where topicid=t.topicid)
ORDER BY t.topicid ASC,th.lastpostdate DESC 
I get the result set as below:- 




forumid
topicid
name
author
lastpostdate
NoOfThreads

1
1
Java Overall
x@y.com
2008-01-27 14:48:53.000
2

1
4
Swings
p@q.com
2008-01-27 15:12:51.000

I want the result set as follows:- 




forumid
topicid
name
author
lastpostdate
NoOfThreads

1
1
Java Overall
x@y.com
2008-01-27 14:48:53.000
2

1
2
JSP
NULL
NULL
0

1
3
EJB
NULL
NULL
0

1
4
Swings
p@q.com
2008-01-27 15:12:51.000
1

1
5
AWT
NULL
NULL
0

1
6
Web Services
NULL
NULL
0

1
7
JMS
NULL
NULL
0

1
8
XML,HTML
NULL
NULL
0

1
9
Javascript
NULL
NULL
0

2
10
Oracle
NULL
NULL
0

2
11
Sql Server
NULL
NULL
0

2
12
MySQL
NULL
NULL
0

3
13
CSS
NULL
NULL
0

3
14
FLASH/DHTLML
NULL
NULL
0

4
15
Best Practices
NULL
NULL
0

4
16
Longue
NULL
NULL
0

5
17
General
NULL
NULL
0  I want all the rows from the Forums,Topics and Threads table and the row with the maximum date (the last post date of the thread) as shown above. 
The scripts for creating the tables and inserting test data is as follows in an already created database:- 
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK__Topics__forumid__79A81403]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Topics] DROP CONSTRAINT FK__Topics__forumid__79A81403
GO 
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[FK__Threads__topicid__7C8480AE]') and OBJECTPROPERTY(id, N'IsForeignKey') = 1)
ALTER TABLE [dbo].[Threads] DROP CONSTRAINT FK__Threads__topicid__7C8480AE
GO 
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Forums]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Forums]
GO 
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Threads]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Threads]
GO 
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Topics]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Topics]
GO 
CREATE TABLE [dbo].[Forums] (
            [forumid] [int] IDENTITY (1, 1) NOT NULL ,
            [name] [varchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
            [description] [varchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL
) ON [PRIMARY]
GO 
CREATE TABLE [dbo].[Threads] (
            [threadid] [int] IDENTITY (1, 1) NOT NULL ,
            [topicid] [int] NOT NULL ,
            [subject] [varchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
            [replies] [int] NOT NULL ,
            [author] [varchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
            [lastpostdate] [datetime] NULL
) ON [PRIMARY]
GO 
CREATE TABLE [dbo].[Topics] (
            [topicid] [int] IDENTITY (1, 1) NOT NULL ,
            [forumid] [int] NULL ,
            [name] [varchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
            [description] [varchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY]
GO 
ALTER TABLE [dbo].[Forums] ADD
             PRIMARY KEY  CLUSTERED
            (
                        [forumid]
            )  ON [PRIMARY]
GO 
ALTER TABLE [dbo].[Threads] ADD
             PRIMARY KEY  CLUSTERED
            (
                        [threadid]
            )  ON [PRIMARY]
GO 
ALTER TABLE [dbo].[Topics] ADD
             PRIMARY KEY  CLUSTERED
            (
                        [topicid]
            )  ON [PRIMARY]
GO  
ALTER TABLE [dbo].[Threads] ADD
             FOREIGN KEY
            (
                        [topicid]
            ) REFERENCES [dbo].[Topics] (
                        [topicid]
            )
GO 
ALTER TABLE [dbo].[Topics] ADD
             FOREIGN KEY
            (
                        [forumid]
            ) REFERENCES [dbo].[Forums] (
                        [forumid]
            )
GO  
------------------------------------------------------ 
insert into forums(name,description) values('Developers','Developers Forum');
insert into forums(name,description) values('Database','Database Forum');
insert into forums(name,description) values('Desginers','Designers Forum');
insert into forums(name,description) values('Architects','Architects Forum');
insert into forums(name,description) values('General','General Forum'); 
insert into topics(forumid,name,description) values(1,'Java Overall','Topic Java Overall');
insert into topics(forumid,name,description) values(1,'JSP','Topic JSP');
insert into topics(forumid,name,description) values(1,'EJB','Topic Enterprise Java Beans');
insert into topics(forumid,name,description) values(1,'Swings','Topic Swings');
insert into topics(forumid,name,description) values(1,'AWT','Topic AWT');
insert into topics(forumid,name,description) values(1,'Web Services','Topic Web Services');
insert into topics(forumid,name,description) values(1,'JMS','Topic JMS');
insert into topics(forumid,name,description) values(1,'XML,HTML','XML/HTML');
insert into topics(forumid,name,description) values(1,'Javascript','Javascript');
insert into topics(forumid,name,description) values(2,'Oracle','Topic Oracle');
insert into topics(forumid,name,description) values(2,'Sql Server','Sql Server');
insert into topics(forumid,name,description) values(2,'MySQL','Topic MySQL');
insert into topics(forumid,name,description) values(3,'CSS','Topic CSS');
insert into topics(forumid,name,description) values(3,'FLASH/DHTLML','Topic FLASH/DHTLML');
insert into topics(forumid,name,description) values(4,'Best Practices','Best Practices');
insert into topics(forumid,name,description) values(4,'Longue','Longue');
insert into topics(forumid,name,description) values(5,'General','General Discussion'); 
insert into threads(topicid,subject,replies,author,lastpostdate) values (1,'About Java Tutorial',2,'a@b.com','1/27/2008 02:44:29 PM');
insert into threads(topicid,subject,replies,author,lastpostdate) values (1,'Java Basics',0,'x@y.com','1/27/2008 02:48:53 PM');
insert into threads(topicid,subject,replies,author,lastpostdate) values (4,'Swings',0,'p@q.com','1/27/2008 03:12:51 PM');
 

View 7 Replies View Related

Decrypting Data

Jun 14, 2006

Hi there,

I am having a table in Sql which has 2 columns which has data in encrypted format. It shows data in junk format (ascii format). But in frontend (tht is in software)it shows data in proper format. Can any one help me in decrypting data.

Thanks,

Regards,


mystical

View 16 Replies View Related

Encrypting And Decrypting Data

Dec 22, 2006

CREATE TABLE TabEncr (
id int identity (1,1),
NonEncrField varchar(30),
EncrField varchar(30)
)

CREATE MASTER KEY ENCRYPTION BY PASSWORD = 'OurSecretPassword'
CREATE CERTIFICATE my_cert with subject = 'Some Certificate'
CREATE SYMMETRIC KEY my_key with algorithm = triple_des encryption by certificate my_cert

OPEN SYMMETRIC KEY my_key DECRYPTION BY CERTIFICATE my_cert
INSERT INTO TabEncr (NonEncrField,EncrField)
VALUES ('Some Plain Value',encryptbykey(key_guid('my_key'),'Some Plain Value'))
CLOSE SYMMETRIC KEY my_key

OPEN SYMMETRIC KEY my_key DECRYPTION BY CERTIFICATE my_cert
SELECT NonEncrField,CONVERT(VARCHAR(30),DecryptByKey(EncrField))
FROM dbo.TabEncr
CLOSE SYMMETRIC KEY my_key

What is the problem with this code. It works fine , inserting the value encrypted but when i try to decrypt ,it returns a null value. What is missing. I also tried with symmetric key encryption with asymmetric key. Result is same, returns NULL value. I am using SQL 2005

Happy Coding...

View 15 Replies View Related

How Many Ways Are Provided By Microsoft To Import Data Into SQL Mobile Database?

Dec 15, 2006

SQL Mobile database seems to not provide import/export utilities.

I think using Publication/Subscription is one of the solution, is it right?

Also, besides typing insert statement manually, there are any other ways to transform data to the SQL Mobile database?

View 3 Replies View Related

Conditional Joins? (table Structure And Sample Data Provided)

Nov 13, 2007

Hello, can anyone tell me if it is possible to conditionally join tables? If so, how could it be done?

What I would like to do is create a query similar to the one below but include the rows in the Asset table where the corresponding Alert field is NULL.


SELECT A.AssetId, A.IndustryId, A.RegionId, A.RevenueId, AL.AlertId

FROM Alerts AS AL INNER JOIN

Assets AS A ON AL.IndustryId = A.IndustryId AND AL.RegionId = A.RegionId AND AL.RevenueId = A.RevenueId
WHERE AlertId = 1

The output I am after would be the first row in the Assets table. But since the RevenueId column is NULL, I get nothing. The only time the above query will work is if all three Id columns are populated. That is not always going to be the case. Please don't suggest changing table structures or adding data. That is not an option.

Below are the table structures and sample data.

CREATE TABLE [dbo].[Alerts](
[AlertId] [int] NOT NULL,
[IndustryId] [int] NULL,
[RegionId] [int] NULL,
[RevenueId] [int] NULL,
CONSTRAINT [PK_Alert] PRIMARY KEY CLUSTERED
(
[AlertId] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]

CREATE TABLE [dbo].[Assets](
[AssetId] [int] NOT NULL,
[IndustryId] [int] NOT NULL,
[RegionId] [int] NOT NULL,
[RevenueId] [int] NOT NULL,
CONSTRAINT [PK_Assets] PRIMARY KEY CLUSTERED
(
[AssetId] ASC,
[IndustryId] ASC,
[RegionId] ASC,
[RevenueId] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]




INSERT INTO Alerts (AlertId, IndustryId, RegionId, RevenueId)

VALUES (1, 2, 5, NULL)

INSERT INTO Alerts (AlertId, IndustryId, RegionId, RevenueId)

VALUES (2, 2, 5, 1)

INSERT INTO Alerts (AlertId, IndustryId, RegionId, RevenueId)

VALUES (3, 2, NULL, NULL)

INSERT INTO Alerts (AlertId, IndustryId, RegionId, RevenueId)

VALUES (4, NULL, 5, NULL)

INSERT INTO Alerts (AlertId, IndustryId, RegionId, RevenueId)

VALUES (5, 3, NULL, 4)

INSERT INTO Alerts (AlertId, IndustryId, RegionId, RevenueId)

VALUES (6, NULL, 4, NULL)

INSERT INTO Alerts (AlertId, IndustryId, RegionId, RevenueId)

VALUES (7, 3, 4, 1)


INSERT INTO Assets (AssetId, IndustryId, RegionId, RevenueId)

VALUES (1, 2, 4, 3)

INSERT INTO Assets (AssetId, IndustryId, RegionId, RevenueId)

VALUES (1, 2, 5, 1)

INSERT INTO Assets (AssetId, IndustryId, RegionId, RevenueId)

VALUES (2, 2, 5, 5)

INSERT INTO Assets (AssetId, IndustryId, RegionId, RevenueId)

VALUES (2, 3, 4, 5)

INSERT INTO Assets (AssetId, IndustryId, RegionId, RevenueId)

VALUES (3, 2, 4, 1)

INSERT INTO Assets (AssetId, IndustryId, RegionId, RevenueId)

VALUES (4, 2, 5, 4)

INSERT INTO Assets (AssetId, IndustryId, RegionId, RevenueId)

VALUES (5, 3, 5, 1)

INSERT INTO Assets (AssetId, IndustryId, RegionId, RevenueId)

VALUES (5, 2, 4, 5)

INSERT INTO Assets (AssetId, IndustryId, RegionId, RevenueId)

VALUES (5, 3, 1, 1)

INSERT INTO Assets (AssetId, IndustryId, RegionId, RevenueId)

VALUES (6, 3, 2, 4)

Thanks.

View 7 Replies View Related

Runtime Error Data Provider Or Other Service Provided An Efail Status

Jul 20, 2005

Anyone knows what would cause this?When Enterprise Manager is used to open a tableRuntime error data provider or other service provided an efail status

View 1 Replies View Related

Decrypting The Password.....

Sep 8, 2007

I have a SQL Server Login and I forgot the password for it.
Is there any way I can decrypt the password. I don't want to
change the password.

Thanks
Venu

View 8 Replies View Related

Problems With Decrypting Columns

Mar 31, 2006

Hi!

I want to encrypt a whole column in my table and I do this with this SQL code:

OPEN symmetric key Sym_Key DECRYPTION BY certificate My_Cert
GO

UPDATE [My_demo].[dbo].[My-DemoList]
SET [Test_crypt] = encryptByKey(Key_GUID('Sym_Key'),[Test])
GO

CLOSE all symmetric keys

GO

And this seems ok but when I want to decrypt it with the view I have created it seems that I get a "rubbish" character between each "real" character.

So my questions is: What am I doing wrong?

Because if I do an insert like this

OPEN symmetric key Sym_Key DECRYPTION BY certificate My_Cert
GO

INSERT INTO [My-DemoList] (Test_crypt) VALUES(encryptByKey(Key_GUID('Sym_Key'),'1234567'))

GO

CLOSE all symmetric keys

And then use my view to look at the decrypted value that I put in its ok.

Many thanks in advance!

View 4 Replies View Related

Decrypting Returns A NULL Value

Apr 26, 2007













I find it weird when decrypting a column from a baked up database and restoring it to another database. Here's the scenario:

Server1 has Database1.
Database1 has Table1 with two columns encyrpted -- Card Number and SS Number
Encryption and decryption in this Database1 is perfectly fine. Records are encrypted and can be decrypted too.
Now, I tried to backup this Database1 and restore it to another server with SQL 2005 instance called Server2. Of course the columns Card and SS Numbers were encrypted. I tried decrypting the columns using the same command to decrypt in Database1, however, it returns a NULL value


Here's exactly what I did to create the encyprtion and decryption keys on the restored database:
-- Create the master key encryption
CREATE MASTER KEY ENCRYPTION BY PASSWORD = 'myMasterPassword'

-- Create a symetric key
CREATE SYMMETRIC KEY myKey WITH ALGORITHM = DES
ENCRYPTION BY Password='myPassword';
Go

-- Create Card Certificate
CREATE CERTIFICATE myCert WITH SUBJECT = 'My Certificate on this Server';
GO

-- Change symmetric key
OPEN SYMMETRIC KEY myKey DECRYPTION BY PASSWORD = 'myPassword';

-- I then verified if the key is opened
SELECT * FROM sys.openkeys




If I create a new database, say Database2 from that Server2, create table, master key, certificate, and symmetric key. Encrpytion and decryption on Database2 will work!




Any suggestions gurus? I tried all searches and help for almost 2 weeks regarding this issue but nobody could resolve this.

Thanks in advance!



faiga16



3 Posts

View 9 Replies View Related

Decrypting Column In Transformation

Oct 2, 2007

I have a OLE DB Source that has a varbinary column of encrypted data. The sorce table is on a hosted SQL Server database where I cannot install a asymetric key. The SSIS package is running on a local SQL Server box that does have the asymetric key installed and working. Can you recommend the best way to transform this column is SSIS using a connection to the local SQL Server box that has the installed public key?

select @encryptedstuff = 0xA19B9F77E5319283311F325D6D29265721A8451148DCD33FA37DF34737C29690BEE35F99972AD7D40F31E8EFE81A30A9B830ABCD1B6BE386462071D67198CE6E52E15FAD84CA62AA35F847948F40B3F8CF4F50D5F2A14D0CCD9FF990F3C1701784F0A8771B93D329144528455937511EF2691BB42A0D4505AC8F9296BF6700801ECE05B102F0CC6DAF204F4EA4C8317AAEDDEC7D83BCD78BA1718C9E55C840AEA280D8BC9CC58D8E05AAE0AE5AC4B7DA0CE7D5DF1DDCAEEA1FB7431ACDF20BBDB2F29ECD744FDEE3D688920E56BEF5508D8224D0DE6AAE8FF944E389D376138885FC4300AFD281C8CC677CDA1762B56D8D1363C7878EAA7A65FC10B8AE168E75

SELECT CONVERT(nvarchar(50),DecryptByAsymKey(AsymKey_ID('rsakey'), REVERSE(@encryptedstuff), N'P4ssw0rd'))



Each row of the OLE DB Source contains a varbinary column with the ecrypted data. I need to to transform that one column and end up with a new record set that contains all of the columns from the OLE DB Source plus a new decrypted column.

Thanks,

Steve

View 4 Replies View Related

Decrypting Encrypted Views/Sp/Functions.....?

Sep 19, 2006

Hi all,As all of you are aware you can Encrypt your Triggers/Stored Procedures/Views And Functionsin Sql Server with "WITH ENCRYPTION" clause.recently i came across a Stored procedure on the Net that could reverse and decrypt all Encrypted objects.i personally tested it and it really works.That's fine (of course for some body)Now i want to know is it a Known Bug for Sql Server 2000 and is there a permanent solution for Encrypting mentioned objects.Thanks in advance.Best Regards.

View 2 Replies View Related

Encryping - Decrypting Stored Procedures

Oct 19, 2004

Hi all...

Im wondering how do you encrypt and decrypt a stored procedure within sql server 2000 ?

i want to be able to encrypt data been inserted / updated using triple des algorithm and then on select / read - decrypt it.

Does anyone know a solution / stored procedure on how to do this? any ideas.

Thanks

Paul..

Im also wondering if there is a away of doing this on the code side without using stored procedures (asp.net c#) i have been able to encrypt and decrpt to a string but unable to do it through the datagrid object (dataset) or a datareader..

Any tips / help would be helpful

Thanks..

View 2 Replies View Related

Decrypting A Table Encrypted With EncryptByKey?

Jan 18, 2012

i have a ms sql base which contains tables encrypted with EncryptByKey, who knows how to make me a script do save the encrypted tables to clear text pm me in ym : hgfrfv or msn : [URL], i have all the keys used on encryption and all those stuff.

View 1 Replies View Related

Decrypting WITH Encryption User Functions...

Jul 20, 2005

....it's possible without any third party application?I need to recover some encrypted user functions but the sources have beenlost long time ago, someone can help me?--Lav.

View 2 Replies View Related

Decrypting And Encrypted Stored Procedure

Sep 6, 2007

Hello,
In SQL 2000,
I have created a Stored Procedure as follows,




Code Snippet

CREATE PROCEDURE MyTest
WITH RECOMPILE, ENCRYPTION
AS
Select * From Customer
Then after this when i run this sp it giving me the perfect results wht i want, BUT when i want to change something in sp then for I am using the below line of code.




Code Snippet

sp_helptext mytest
But its displaying me that this sp is encrypted so you can't see the details and when i am trying to see trhe code of this sp from enterprise manager then also its not displaying me the details and giving me the same error,
So i want to ask that if there is a functionality of enrypting the sp code then is there any functionality for decrypting the Stored Procedure also,
or not,
If yes then wht it is and if NO then wht will be the alternative way for this,
?????

View 2 Replies View Related

SQL 2012 :: Decrypting Encrypted Fields From Another Database

May 5, 2015

I am executing a stored procedure in one database (Database1) that pulls data from another database (Database2) that is the back end for a third party application. Some of the fields in that other database are now encrypted. I need to decrypt those fields but since the query is running in a database other than where the data lives (which is also where the symmetric key + cert lives), I am getting the following error: "Cannot find the symmetric key" Below is an example of what I am running in the stored procedure:

OPEN SYMMETRIC KEY [XXXXKey] DECRYPTION
BY CERTIFICATE [XXXX_CERT];
select CONVERT(Varchar(50), DECRYPTBYKEY( <ENCRYPTED FIELD> ))
FROM Database2.dbo.TABLE1
CLOSE SYMMETRIC KEY [XXXXKey];

What do I need to add to Database1 so the stored procedure can decrypt the data it pulls from Database2?

View 5 Replies View Related

Decrypting Password Of SysxLogins Table - SQL Database.

Dec 15, 2005

Hi,

    Is there any way of decrypting password value stored in sysxlogins table of SQL database?

Thx in Adv

 

 

View 4 Replies View Related

Custom Connection Manager Or SSIS Provided One?

Jul 20, 2006

Hi,

I have been working with a client on a legacy application migration to SSIS and I found SSIS to be very helpful, as this is my first project using integration services I found myself in a situation where multiple solutions can work but I cannot assess the risk of using one or the other and the effort required for the implementation.

The situation is as following, we cannot touch the input files that come from the other legacy systems so I need to get information that is packaged following the next multipart schema:

&Header with context information from the source
&BatchHeader with context information from the batch (including format N)
- Data in format N
&BatchHeader with context information from the batch (including format K)
+Data in format K
&BatchHeader with context information from the batch (including format P)
=Data in format P

Etc... Needless to say that they can come in whatever order and they need different processing depending on the format. I have been tempted to use the techniq shown in "Handling Different Row Types In The Same File" from http://www.sqlis.com/default.aspx?54.

However, there are multiple issues that I have to resolve to do that: First is how to feed the pipeline with the Data in format N and then reparse them in an easy way cause the data that comes from the other system is very wide (aprox 120 columns), so using a parsing script is by no means a viable solution (I have multiple formats to handle). So I do not see a way to treat the data without using a Custom Connection Manager. Here comes my first question: Is there anyway someone can use the already provided managers to handle an scenario like this one?

Next comes the separation, which one is the wisest thing to do: Write again that to disk in as easier format or pass along that information to the next task in memory? The volume of data is in the order of hundreds of megabytes (100 to 200), maybe half a Gigabyte in the extreme cases. How about uploading that to SQL Server and work from there?

BTW, the production servers will have 6 to 8 Gb of memory and 4 to 8 processors (more or less).

Thanks in advance.

Federico



View 6 Replies View Related

DB Design :: Password Did Not Match That For Login Provided

Jun 4, 2015

i am getting bellow error Error: 18456, Severity: 14, State: 8.Login failed for user 'sa'. Reason: Password did not match that for the login provided. but no one is logging for that particular [clint :ip].this error occurring automatically. in this case in my environment log shipping is configured and the secondary database server getting this issue.when i disable the copy and restore jobs and bring  the database in online. i am not getting that error .

View 3 Replies View Related

DECRYPTING A Column Permanently With Table UPDATE

Mar 17, 2008

In SQL 2005, I've created a test scenario in AdventureWorks where I:

1.) Create a database master key:

IF NOT EXISTS (SELECT * FROM sys.symmetric_keys WHERE symmetric_key_id = 101)
CREATE MASTER KEY ENCRYPTION BY PASSWORD = '<password>'

GO

2.) Create a certificate:

CREATE CERTIFICATE HRCert
WITH SUBJECT = 'Comments'
GO

3.) Create a symmetric key:

CREATE SYMMETRIC KEY CommentKey
WITH ALGORITHM = DES
ENCRYPTION BY CERTIFICATE HRCert
GO

4.) Add a test column to the HumanResources.JobCandidate table:

ALTER TABLE HumanResources.JobCandidate
ADD Comments varbinary(8000)
GO

5.) Open the symmetric key for use:

OPEN SYMMETRIC KEY CommentKey
DECRYPTION BY CERTIFICATE HRCert
GO

6.) Insert and Encrypt values ('Yes') to the newly created column:

UPDATE HumanResources.JobCandidate
SET Comments = EncryptByKey(Key_GUID('CommentKey'), 'Yes')
GO

-------


Great. Now all the textbooks say that, to view the column values in a decrypted state, you should:

SELECT CONVERT(varchar, DecryptByKey(Comments)) AS [Decrypted Comments], *
FROM HumanResources.JobCandidate


------

Great, I get it. But here's the rub. What is the best way to permanently decrypt the column and keep it in a cleartext state?

Running the following works, but keeps the column values in a varbinary (hexadecimal) state which is what we originally created:

UPDATE HumanResources.JobCandidate
SET Comments = DecryptByKey(Comments)
GO

But if I want to transform this varbinary(8000) column into a human-readable varchar column, the only thing I could come up with was a temp table solution:

UPDATE HumanResources.JobCandidate
SET Comments = DecryptByKey(Comments)
GO

DECLARE @temp varchar(1000)
SET @temp = (SELECT TOP 1 CommentsFROM Human Resources.JobCandidate)

CREATE TABLE #decrypt (Comment varchar(1000))
INSERT INTO #decrypt (Comments) VALUES (@temp)
GO

ALTER TABLE HumanResources.JobCandidate
ALTER COLUMN Comments varchar(1000)
GO

UPDATE HumanResources.JobCandidate
SET Comments = (SELECT Comments FROM #decrypt)
GO

DROP TABLE #decrypt
GO

--------

It works, but seems so inelegant to me.

Is there an easier way?

View 5 Replies View Related

DB Design :: Password Did Not Match For Login Provided

Jun 8, 2015

i am getting bellow error 

Error: 18456, Severity: 14, State: 8.
Login failed for user 'sa'. Reason: Password did not match that for the login provided. [CLIENT:####]
Login failed for user [sa]
Error: 18456, Severity: 14, State 38

Failed to open the explicitly specified database but no one is logging for that particular [clint :ip].this error occurring automatically. in this case in my environment log shipping is configured and the secondary database server getting this issue.when i disable the copy and restore jobs and bring  the database in online. i am not getting that error .

View 17 Replies View Related

DecryptByPassPhrase Not Decrypting Varchar Columns After Copying A Database

Jan 18, 2007

I have an encrypted column of data that is encrypted by a passphrase. The passphrase was encrypted by a symetric key in a key pair. The passphrase also is stored in a table. I can get the passphrase as needed to encrypt/decrypt the columns. I copied the production database to a new database for development. Subsequently I had to create a new symmetric/asymmetic key pair and recreated my passphrase with the new key pair. Now the passphrase will decrypt a text column but it will not decrypt two other columns which are of type varchar in the database. Here is an example:

DECLARE @pss varchar(30)
EXEC [dbo].[uspPassPhraseGet] @pss OUTPUT

SELECT DISTINCT contactid, uissueid, createdby, created_dt
,CONVERT(varchar(max),DecryptByPassPhrase(@pss, CONVERT(varchar(max),dbo.tbl_msg_app_legislativeinquiry.title), 1, CONVERT(varbinary, 23))) as title
,CONVERT(varchar(max),DecryptByPassPhrase(@pss, CONVERT(varchar(max),dbo.tbl_msg_app_legislativeinquiry.description), 1, CONVERT(varbinary, 23))) as description
,CONVERT(varchar(max),DecryptByPassPhrase(@pss, CONVERT(varchar(max),dbo.tbl_msg_app_legislativeinquiry.shortdesc), 1, CONVERT(varbinary, 23))) as shortdesc,
closed_dt, confidential, statusid, due_dt, deleted_dt,deletedbyid, highrisk, dbo.tbl_msg_app_legislativeinquiry.designator, dbo.tbl_ref_sys_status.description AS statusdesc
FROM dbo.tbl_msg_app_legislativeinquiry INNER JOIN
dbo.tbl_ref_sys_status ON statusid = dbo.tbl_ref_sys_status.ustatusid INNER JOIN
dbo.tbl_gbl_lkp_security ON uissueid = dbo.tbl_gbl_lkp_security.msgid AND
dbo.tbl_msg_app_legislativeinquiry.designator = dbo.tbl_gbl_lkp_security.designator

Like I said I can execute the uspPassPhraseGet stored procedure and I get my passphrase. It will correctly decrypt the dbo.tbl_msg_app_legislativeinquiry.description field which is great but the other two fields will not decrypt. When i copied the database over the encrypted fields do not display the same on the new database. The old database shows a box character followed by a bunch of junk (as expected). The new copied table on the new database shows only a single box (not the same as the original). Is there a known bug with copying a table with varchar fields that are encrypted to a new database? I tried to run a test and got the same result. I also tried to convert the varchar columns to text to see if that solved the problem and it didn't. The description field however is a text type column and it reads exactly as the original. The problem I think is that the Copy Database didn't actually copy my data correctly. How can I get the original encrypted data from the production into my development. I also tried just dropping the table and reimporting the table but that didnt take either. Scratching my head on this one.

View 5 Replies View Related

Reporting Services :: Possible To Set Up Report Subscription In SSRS Where There Is No Value Provided

Sep 24, 2015

Is it possible to set up a report subscription in SSRS where there is no value provided for the 'To' address, instead adding all recipients into the BCC field, so that each recipient receives a copy of the report without being able to see the other recipients?Note, i am wanting to create a data driven subscription rather than a static subscription. I am using SSRS 2008 r2.

View 3 Replies View Related

SQL 2012 :: Allow For User Provided Number Of Columns In Select Statement

Aug 20, 2014

I am currently trying to write a query that pulls a summation of item specific data from sales orders. For simplicity's sake, the column structure can be something like the following...

Item#,
PoundsDuringWeekNumber (this would be the current week number out of the 52 weeks in a year and the pounds of the item during that week)

However, those are not going to be the only 2 columns. The idea of the query is that the user would be able to provide the query a date range (say 2 months) and the columns would then morph into the following...

Item#,
PoundsDuringWeekNumber (current),
PoundsDuringWeekNumber(current - 1),
PoundsDuringWeekNumber (current - 2),
etc. etc.
PoundsDuringWeekNumber(current - 8)

Initial ideas where to create a function to execute the summation of the pounds during the date range of the week in question and execute it across the columns, but with the indeterminable number of columns, the query would not know how many times to execute the function.

View 1 Replies View Related

Merge Replication Error: 'Failure To Connect To SQL Server With Provided Connection

Mar 6, 2007

Hi!I´m trying to create a merge replication publication for a SQL MobileApplication .Everything works fine creating the publication and I'm able to dothehttp://xxx.xxx.xxx.xxx/aaaaaaa/sqlcesa30.dll, and it display's the"sql server mobile server agent 3.0".But when I run the application on the PDA and it´s doing thereplication it appears the following error:'Failure to connect to SQL Server with provided connectioninformation . SQL Server does not exist , access is denied becausetheIIS user is not a valid user on the SQL Server , or the password isincorrect' .any idea of which could be the reason...?Thanks in advance!!!

View 1 Replies View Related

Getting This Warning [Excel Source 1 [12717]] Error: A Destination Table Name Has Not Been Provided.

Apr 25, 2008

Hello,
I am getting this warning message,when I am trying to load an excel file to a table
[Excel Source 1 [12717]] Error: A destination table name has not been provided.


These are the steps I am performing
EXCEL source
|
Data Conversion
|
OLEDB Destination

In the EXcel Source I have the Data Access Mode as
Table Name or View Name variable

Am I missing something.. I tried to give a default value in the variable and then I am getting this warning


Error at Data Flow Task [Excel Source 1 [12717]]: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80040E37.
Error at Data Flow Task [Excel Source 1 [12717]]: Opening a rowset for "Order" failed. Check that the object exists in the database.


Any help is really appreciated.

Thank You.

View 4 Replies View Related

Problem Opening Database: The Operating System Does Not Support The Encryption Mode Provided.

Oct 12, 2007

I have created an .sdf database on my Desktop - and am able to open and close it just fine from my application program.

Whenever I try to:

Open it with the same program but installed on a different PC,

or:

Open it from a program running as a service on the development PC, I get the error

"The operating system does not support the Encryption Mode provided."

The working above is from the Version 3.5 Beta, but the same problem occurs with Version 3.1.

The Error code in Hex is 80004005

I can't find any reference to fixing this error - any ideas?

View 2 Replies View Related

The Stream Cannot Be Found. The Stream Identifier That Is Provided To An Operation Cannot Be Located In The Report Server Databa

Apr 6, 2008

I receive this error when I make a depolyment to our new server(virtual server).
The report works fine in the report manager. In my application, I use RenderStream method to retrieve the images and embed in the webform. I googled it and found some people having the same issue because of the cookie, so they set 'UseSessionCookies' = false in the table ConfiurationInfo of ReportServer database. I tried this, but no luck.

Also, there is a hotfix from Microsoft http://support.microsoft.com/kb/913363.
I have requested a copy, but not sure whehter it's gonna be helpful.


Any clues or suggestions weclome.

Thanks

View 18 Replies View Related

SQL Tools :: Media Set Has 2 Media Families But Only 1 Provided

Feb 13, 2014

We are getting error and we are aware that there should be 2 files but we are able to find the second file,how to search all files(2) so that we may restore DB.

View 4 Replies View Related

The Media Set Has 2 Media Families But Only 1 Are Provided

Nov 6, 2007

Hi, I'm from Argentina. I made a backup of my database from ServerA (SQL 2000) and trying to restore it to ServerB (SQL 2005) I'm getting the following error: "The media set has 2 media families but only 1 are provided".

Any ideas? Thanks.

View 5 Replies View Related

Sampling Data Set Via Integration Services Data Flow For Data Mining Models Without Saving Training And Test Data Set?

Nov 24, 2006

Hi, all here,

Thank you very much for your kind attention.

I am wondering if it is possible to use SSIS to sample data set to training set and test set directly to my data mining models without saving them somewhere as occupying too much space? Really need guidance for that.

Thank you very much in advance for any help.

With best regards,

Yours sincerely,

View 5 Replies View Related

System.Data.SqlClient.SqlException: The Conversion Of A Char Data Type To A Datetime Data Type Resulted In An Out-of-range Datetime Value.

Dec 14, 2005

After testing out the application i write on the local pc. I deploy it to the webserver to test it out. I get this error.

System.Data.SqlClient.SqlException: The conversion of a char data type to a
datetime data type resulted in an out-of-range datetime value.

Notes: all pages that have this error either has a repeater or datagrid which load data when page loading.

At first I thought the problem is with the date, but then I can see
that some other pages that has datagrid ( that has a date field) work
just fine.

anyone having this problem before?? hopefully you guys can help.

Thanks,

View 4 Replies View Related







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