Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Problem with encryption


Problem with encryption

Author
Message
maykabog
maykabog
Forum Newbie
Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)

Group: General Forum Members
Points: 6 Visits: 21
Hi,
I can't execute any of encryption commands.
For example,when I write :
CREATE CERTIFICATE ElmerEncryptionCertificate
WITH
SUBJECT = 'Elmer Certificate',
EXPIRY_DATE = '01/01/2006 '

I receice :
Incorrect syntax near 'CERTIFICATE'.

I have installed SP2.
Can anyone help me pls?
Rajesh kasturi
Rajesh kasturi
SSC-Enthusiastic
SSC-Enthusiastic (185 reputation)SSC-Enthusiastic (185 reputation)SSC-Enthusiastic (185 reputation)SSC-Enthusiastic (185 reputation)SSC-Enthusiastic (185 reputation)SSC-Enthusiastic (185 reputation)SSC-Enthusiastic (185 reputation)SSC-Enthusiastic (185 reputation)

Group: General Forum Members
Points: 185 Visits: 732
You are giving expiry date '01/01/2006' Execute as below it will be ok

CREATE CERTIFICATE ElmerEncryptionCertificate
WITH
SUBJECT = 'Elmer Certificate',
EXPIRY_DATE = '01/01/2009'

Regards
Rajesh Kasturi

Rajesh Kasturi
maykabog
maykabog
Forum Newbie
Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)

Group: General Forum Members
Points: 6 Visits: 21
Hi,thanks for your replay,but it didn't help me.
I think that there is a problem with some settings.
Maybe I have to install some service pack?Or to do something in operating system?
Rajesh kasturi
Rajesh kasturi
SSC-Enthusiastic
SSC-Enthusiastic (185 reputation)SSC-Enthusiastic (185 reputation)SSC-Enthusiastic (185 reputation)SSC-Enthusiastic (185 reputation)SSC-Enthusiastic (185 reputation)SSC-Enthusiastic (185 reputation)SSC-Enthusiastic (185 reputation)SSC-Enthusiastic (185 reputation)

Group: General Forum Members
Points: 185 Visits: 732
I do not think you need to do some thing with sp or operating system.

Please tell me little bit more what is the exact problem you are facing.

Rajesh Kasturi
Rajesh kasturi
Rajesh kasturi
SSC-Enthusiastic
SSC-Enthusiastic (185 reputation)SSC-Enthusiastic (185 reputation)SSC-Enthusiastic (185 reputation)SSC-Enthusiastic (185 reputation)SSC-Enthusiastic (185 reputation)SSC-Enthusiastic (185 reputation)SSC-Enthusiastic (185 reputation)SSC-Enthusiastic (185 reputation)

Group: General Forum Members
Points: 185 Visits: 732
Please execute the below script step by step and let me know where the scrip is getting fail.

--Step 1: Create database masterkey for Test
USE Test
CREATE MASTER KEY ENCRYPTION BY PASSWORD = 'Raj3sH'

--Step 2: Create database certificate
CREATE CERTIFICATE Certificate1 WITH SUBJECT = 'Test'

--Step 3: Create a symetric key encrypted by the certificate
CREATE SYMMETRIC KEY TestKey09 WITH ALGORITHM = TRIPLE_DES ENCRYPTION BY CERTIFICATE Certificate1;
GO
--Step 4: Create a Column in which to store the encrypted data
CREATE TABLE TEST (ID VARCHAR(80), EncrypIDN varbinary(128))
go
ALTER TABLE TEST ADD EncrypIDN varbinary(128)

--Step 5: Open the symetric key with which to encrypt the data
OPEN SYMMETRIC KEY TestKey09 DECRYPTION BY CERTIFICATE Certificate1;

--Step 6
DECLARE @I INT
SET @I = 100

WHILE @I <>0
BEGIN
INSERT INTO TEST(ID) VALUES(@I)
SET @I = @I -1
END
GO
UPDATE TEST SET EncrypIDN = EncryptByKey(Key_GUID('TestKey09'),ID)

--Step 7: Open the symetric key with which to decrypt the data
OPEN SYMMETRIC KEY TestKey09 DECRYPTION BY CERTIFICATE Certificate1;

--Step 8: Compare the data
SELECT ID, EncrypIDN, CONVERT(varchar,DECRYPTBYKEY(EncrypIDN)) FROM TEST

Regards
Rajesh Kasturi

Rajesh Kasturi
maykabog
maykabog
Forum Newbie
Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)

Group: General Forum Members
Points: 6 Visits: 21
I tryed to execute step 1 and reseive this message:
Incorrect sysntax neas MASTER
Rajesh kasturi
Rajesh kasturi
SSC-Enthusiastic
SSC-Enthusiastic (185 reputation)SSC-Enthusiastic (185 reputation)SSC-Enthusiastic (185 reputation)SSC-Enthusiastic (185 reputation)SSC-Enthusiastic (185 reputation)SSC-Enthusiastic (185 reputation)SSC-Enthusiastic (185 reputation)SSC-Enthusiastic (185 reputation)

Group: General Forum Members
Points: 185 Visits: 732
Are you new to SQL Server.

Rajesh Kasturi
Rajesh kasturi
Rajesh kasturi
SSC-Enthusiastic
SSC-Enthusiastic (185 reputation)SSC-Enthusiastic (185 reputation)SSC-Enthusiastic (185 reputation)SSC-Enthusiastic (185 reputation)SSC-Enthusiastic (185 reputation)SSC-Enthusiastic (185 reputation)SSC-Enthusiastic (185 reputation)SSC-Enthusiastic (185 reputation)

Group: General Forum Members
Points: 185 Visits: 732
may be you do not have test database in your server.
use your database name in place of test.

or execute the below statement

CREATE DATABASE test

Rajesh Kasturi
maykabog
maykabog
Forum Newbie
Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)Forum Newbie (6 reputation)

Group: General Forum Members
Points: 6 Visits: 21
Database test exist
Rajesh kasturi
Rajesh kasturi
SSC-Enthusiastic
SSC-Enthusiastic (185 reputation)SSC-Enthusiastic (185 reputation)SSC-Enthusiastic (185 reputation)SSC-Enthusiastic (185 reputation)SSC-Enthusiastic (185 reputation)SSC-Enthusiastic (185 reputation)SSC-Enthusiastic (185 reputation)SSC-Enthusiastic (185 reputation)

Group: General Forum Members
Points: 185 Visits: 732
really I did not understand what is your problem.

Rajesh Kasturi
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search