3 Questions About Certificate

Nov 1, 2007

As we know ,certificate is a digitallly-signed security object that bind the public key to the principal who holds the private key.




Say i create a certificate by using create certificate DDL, then use it to encrypt data and decrypt data as follows:





Code Block
create certificate cert1 encryption by password='p@ssw0rd1' with subject='certificate test'
go
declare @plaintext varchar(100)
set @plaintext='abcd'
declare @cipher varbinary(8000)
set @cipher=encryptbycert(cert_id('cert1'),@plaintext)
select convert(varchar,decryptbycert(cert_id('cert1'),@cipher,N'p@ssw0rd1'))












Is that mean i create public key implicitly when i run "create certificate cert1 encryption by password='p@ssw0rd1' with subject='certificate test'"?

What cryptography algorithm would be use when i use the certificate to encrypt data ?
Where is private key? I ensure I use the public key which generated from "create certificate " DDL to encrypt data .I want to know which private key i used when i execute decryptbycert to decrypt.



View 7 Replies


ADVERTISEMENT

Certificate Loading Issue - When Creating Certificate From SQL Server To SQL Server Express On The Same Machine

Jun 29, 2007

Hi, We are trying to implement Service Broker between SQL Server Express and SQL Server on the Same machine and we are having problems with certificates. We are creating a certificate on SQL Server, backing up the certificate on a file system and then loading certificate on the SQL Server Express from the file and we are keep getting the following error: Msg 15208, Level 16, State 1, Line 1 The certificate, asymmetric key, or private key file does not exist or has invalid format.



Following script runs fine on SQL Server.




Code Snippet

use master



Create Master Key Encryption BY Password = '45Gme*3^&fwu';

BACKUP MASTER KEY TO FILE = 'C:ServiceBrokerPrivateKeyMasterB.pvk'

ENCRYPTION BY PASSWORD = '45Gme*3^&fwu'

Create Certificate EndPointCertificateC

WITH Subject = 'C.Server.Local',

START_DATE = '06/01/2006',

EXPIRY_DATE = '01/01/2008'

ACTIVE FOR BEGIN_DIALOG = ON;

BACKUP CERTIFICATE EndPointCertificateC

TO FILE = 'C:ServiceBrokerEndPointCertificateC.cer'



Following script runs on SQL Server Express:






Code Snippet

Create Certificate EndPointCertificateC

From FILE = 'C:ServiceBrokerEndPointCertificateC.cer'

WITH PRIVATE KEY (

FILE = 'C:ServiceBrokerPrivateKeyMasterB.pvk',

DECRYPTION BY PASSWORD = '45Gme*3^&fwu'

);





If we run the script other way around, it works fine. If we use the SQL Server on some other machine, the script works fine. But only on the same machine, it throws this error. We made sure the permissions and everything. Let us know if there is any work around or what are we doing wrong.



Any help is appreciated. Thank you,

View 4 Replies View Related

Reg : Certificate

Mar 4, 2008

Hello all,

can ayone tell me which exam i have to pass to get sql 2005 certificate andi n which site or link will get more information.

would be appreciated .
thanks folks.

View 2 Replies View Related

Encryption With Certificate

Apr 19, 2007

 I am trying to create a encrypted row in my database Everything here worked except that when i run the final query to decrypt the data It just comes up with null for each row. Even if i do a query to show me the rows that are not null It's like it is saying yeah there is data here but I am only going to show you null instead of what I am supposed to decrypt.Here is what I tried from start to finish Create Certificate
TestCert
Encryption By Password = 'Password'
With Subject = 'SQLCert',
Expiry_Date = '12/01/2050';


declare @Test nvarchar(50)
set @Test='123456789'

insert into testenc (testencry)
Values
(encryptbyCert(Cert_ID('TestCert'),@Test ))


select convert (Nvarchar(50),
DecryptByCert(Cert_ID('TestCert'),
testencry,N'Password')) As Test
from testenc 

View 2 Replies View Related

Self-Signed Certificate

Mar 10, 2006

Can anybody can tell me how to do self-signed certificate on sql server? What is it ? Do we really need?
Many thanks.

View 12 Replies View Related

MSDBA Certificate

Dec 24, 2007

Hi,

does anybody have MSDBA certificate? I need some additional information on time, money costs, advantages, disadvantages, literature, etc.

I've browsed my local Microsofr partner as well as microsoft homepage, and haven't found any "interesting" feedback :)

thank you in advance

View 1 Replies View Related

Cannot Drop Certificate.

Apr 27, 2007

im trying to drop all certificates on my database, and then the master key, but cannot do this as there are objects encrypted by one particular cert that i called fcert. I done this ages ago and cannot remember what i encrypted with this cert. to drop the master key i have to drop the cert and to drop the cert i have to make sure no objects are encrypted by it. how is this achieved?

View 1 Replies View Related

Certificate Encryption

Apr 22, 2008

i'm totally stuck, i know i must be missing something, just can't find it.. here's my situation:

tbl_user (ssn char(9), ssn_encrypted varchar(9));

CREATE CERTIFICATE AUTOCERT WITH SUBJECT = 'Salad', EXPIRY_DATE = '1/1/2099';GO


UPDATE tbl_userset ssn_encrypted = encryptbycert(cert_id('AUTOCERT'),SSN)go

select ssn, ssn_encrypted from tbl_user

results look good. encryption worked.

SELECT ssn, decryptbycert(cert_id('AUTOCERT'),ssn_encrypted) FROM tbl_user

results of select statement show ssn_encrypted = null for every record.

why is it null? how can i get decryption to work?

View 4 Replies View Related

Add A PFX Certificate Into A SQL Database

Mar 6, 2008

I can use "CREATE CERTIFICATE" to add a CER certificate into a SQL database. How can I do so with a PFX certificate? From the document, it can be done so with a CER file and a PVK file, but only a PFX file.

View 1 Replies View Related

Create Certificate

Dec 6, 2006

hey,
I am
having a weired issue(donno whether its weired or not.). I have a user
who has db_owner rights on a database. But when he is trying to create
a certificate he is getting error.
"Msg 15247, Level 16, State 1, Line 1
User does not have permission to perform this action."
Remember he is having db_owner rights on that particular database. is there any other permission that i have to give him.

View 5 Replies View Related

Removing A Certificate

Apr 28, 2008



Hi i'm having issues removing this certificate

select * from sys.certificates





I see


cert_xp_cmdshell_enabler 257 1 NA NO_PRIVATE_KEY 1 Enable xp_cmdshell c5 30 7d 58 ba 8e 96 a6 48 48 df ca 87 bc 91 44 0x010600000000000901000000BEC4CB23E7994CFF1E71403F906BB1EFFDDEAF9A S-1-9-1-600556734-4283210215-1061187870-4021382032-2595217149 Enable xp_cmdshell 2009-04-28 10:31:31.000 2007-04-28 10:31:31.000 0xBEC4CB23E7994CFF1E71403F906BB1EFFDDEAF9A NULL


DROP CERTIFICATE cert_xp_cmdshell_enabler


he certificate cannot be dropped because one or more entities are either signed or encrypted using it.


Is there any way I can drop this as I would like to recreated it and add a whole host of sps that I need to use the xp_cmdshell.


Thanks in advance.







View 4 Replies View Related

Certificate Not Yet Valid

Dec 22, 2006

Hi guys,



I'm having this really strange issue with mirroring.

I've followed the instructions on http://msdn2.microsoft.com/en-us/library/ms191140.aspx to the letter, leaving out the witness server part, as I don't have one.



All works OK, but when activating the mirroring on the principal server I get the usual error 1418 error. I fired up SQL Server Profiler to see what was happening, and the following error emerged.

Connection handshake failed. The certificate used by the peer is invalid due to the following reason: Certificate not yet valid. State 104.



Anyone have any ideas?

View 3 Replies View Related

SQL Express SSL Certificate

Sep 30, 2006

Hello:

I am trying to get SQL Express to use a certificate for SSL encryption between the server and client. Our company has a certificate server and I already did generate a server certificate from it. I installed the certificate in the "local machine" store and I also have the CA certificate in the trusted root on the server machine. (XP PRO)

When I use the configuration tool, I get to the "protocols for SQLEXPRESS" area, I click properties, I select the certificate tab, but there are no certificates available from which to choose.

Can someone shed some light on where I might go from here?

Larry



View 3 Replies View Related

Certificate Not Found

Jun 30, 2006

Hello,

I have two different instances of sql server 2005 but i get

Connection handshake failed. The certificate used by the peer is invalid due to the following reason: Certificate not found. State 89.

This is one of the two instances:

use master

--ALTER MASTER KEY REGENERATE WITH ENCRYPTION BY PASSWORD = 'dsjdkflJ435907NnmM#sX003'

create master key encryption by password = 'hello'

create certificate [Certificato2]

from file = 'c:certsTransportCert2.cer'

with private key (FILE='c:certsTransportCert2.pvk',

decryption by password='simone')

active for begin_dialog = ON

 

CREATE LOGIN [M02] WITH PASSWORD = 'wrPqYkr%bm3';

ALTER LOGIN [M02] DISABLE;

CREATE USER [M02] FROM LOGIN [M02];

GO

create certificate [Certificato1]

authorization [M02]

from file = 'c:certsTransportCert1.cer'

active for begin_dialog = ON

GO

 

USE PublisherdDB

--ALTER MASTER KEY REGENERATE WITH ENCRYPTION BY PASSWORD = 'dsjdkflJ435907NnmM#sX003'

create master key encryption by password = 'hello'

create certificate [CertificatoDialogo2]

from file = 'c:certsDialogCert2.cer'

with private key (FILE='c:certsDialogCert2.pvk',

decryption by password='simone')

active for begin_dialog = ON

 

CREATE USER [Proxy::IsDbLookupRequestServiceM02] WITHOUT LOGIN;

GO

create certificate [CertificatoDialogo1]

authorization [Proxy::IsDbLookupRequestServiceM02]

from file = 'c:certsDialogCert1.cer'

active for begin_dialog = ON

 

CREATE REMOTE SERVICE BINDING [RSB::IsDbLookupRequestServiceM02]

TO SERVICE 'IsDbLookupRequestServiceM02'

WITH USER = [Proxy::IsDbLookupRequestServiceM02],

ANONYMOUS = OFF;

GO

CREATE ROUTE [Route::IsDbLookupRequestServiceM02,D516E70B-59D6-4BF4-882A-BDA7ACD6EB07] WITH

SERVICE_NAME = 'IsDbLookupRequestServiceM02',

ADDRESS = 'tcp://PORTATILEXP:4022';

GO

GRANT SEND ON SERVICE::[IsDbLookupResponseService] TO [Proxy::IsDbLookupRequestServiceM02]

GO

 

USE MASTER

CREATE ENDPOINT [BROKER]

AUTHORIZATION [VIDEOSYSTEMSimone_Farinea]

STATE=STARTED

AS TCP (LISTENER_PORT = 4033, LISTENER_IP = ALL)

FOR SERVICE_BROKER (MESSAGE_FORWARDING = DISABLED

, MESSAGE_FORWARD_SIZE = 10

, AUTHENTICATION = CERTIFICATE [Certificato2]

, ENCRYPTION = REQUIRED ALGORITHM RC4)

GRANT CONNECT ON ENDPOINT::[BROKER] TO [M02];

 

Here is the second one:

use master

--ALTER MASTER KEY REGENERATE WITH ENCRYPTION BY PASSWORD = 'hello'

create master key encryption by password = 'hello'

create certificate [Certificato1]

from file = 'c:certsTransportCert1.cer'

with private key (FILE='c:certsTransportCert1.pvk',

decryption by password='simone')

active for begin_dialog = ON

 

 

CREATE LOGIN [SIMONEX] WITH PASSWORD = 'wrPqYkr%bm3';

ALTER LOGIN [SIMONEX] DISABLE;

CREATE USER [SIMONEX] FROM LOGIN [SIMONEX];

GO

 

 

create certificate [Certificato2]

authorization [SIMONEX]

from file = 'c:certsTransportCert2.cer'

active for begin_dialog = ON

GO

 

 

USE vsi

--ALTER MASTER KEY REGENERATE WITH ENCRYPTION BY PASSWORD = 'hello'

create master key encryption by password = 'hello'

create certificate [CertificatoDialogo1]

from file = 'c:certsDialogCert1.cer'

with private key (FILE='c:certsDialogCert1.pvk',

decryption by password='simone')

active for begin_dialog = ON

CREATE USER [Proxy::IsDbLookupResponseService] WITHOUT LOGIN;

GO

create certificate [CertificatoDialogo2]

authorization [Proxy::IsDbLookupResponseService]

from file = 'c:certsDialogCert2.cer'

active for begin_dialog = ON

GRANT SEND ON SERVICE::[IsDbLookupRequestServiceM02] TO [Proxy::IsDbLookupResponseService]

GO

 

CREATE ROUTE [Route::IsDbLookupResponseService,88EB00C4-8CA9-4B45-9899-677AA70818B1] WITH

SERVICE_NAME = 'IsDbLookupResponseService',

ADDRESS = 'tcp://SIMONEX:4033';

GO

 

 

 

USE MASTER

CREATE ENDPOINT [BROKER]

AUTHORIZATION [VIDEOSYSTEMSimone_Farinea]

STATE=STARTED

AS TCP (LISTENER_PORT = 4022, LISTENER_IP = ALL)

FOR SERVICE_BROKER (MESSAGE_FORWARDING = DISABLED

, MESSAGE_FORWARD_SIZE = 10

, AUTHENTICATION = CERTIFICATE [Certificato1]

, ENCRYPTION = REQUIRED ALGORITHM RC4)

GRANT CONNECT ON ENDPOINT::[BROKER] TO [SIMONEX];

What's wrong in my code?

Many thanks.

 

 

View 1 Replies View Related

Certificate Not Found

Feb 19, 2007

Hello I haw trouble getting the service broker to work I have 3 instances of SQL servers:

1 €śSender€? SQL 2005 Server
2 €śReceiver 1€? SQLEXPRESS 2005
3 €śRecevier 2€? SQLEXPRESS 2005

What I wont is to be abele to do is to send a message from €śSender€? to €śReceiver 1€? or €śRecevier 2€?.

I am abele to send a message from €śSender€? to €śReceiver 1€? but if I send a message to €śReceiver 2€? I get a dialog security problem I think. If I use profiler I can se in €śReceiver 2€? the events:

Broker:Connection
Audit Broker Login
Broker:Message Classify
Audit Broker Conversation = Certificate not found
Broker:Message Undeliverable

And I cant find what´s wrong, this Is my scripts for etch instance.

€śSender€?

USE master

CREATE CERTIFICATE Cert_ROBOTSRV
WITH SUBJECT = 'Cert_ROBOTSRV_auth',
START_DATE = '02/15/2007',
EXPIRY_DATE = '02/15/2015'
GO
BACKUP CERTIFICATE Cert_ROBOTSRV TO FILE = 'C:Cert_ROBOTSRV'

GO

CREATE ENDPOINT SBEndpointServer STATE = STARTED
AS TCP (LISTENER_PORT = 5723)
FOR SERVICE_BROKER (AUTHENTICATION = CERTIFICATE Cert_ROBOTSRV)

GO
CREATE USER andon


CREATE CERTIFICATE Cert_sevapc311_pub AUTHORIZATION andon
FROM FILE = 'C:Cert_sevapc311'

--DROP CERTIFICATE Cert_Andonpc017_Trans
CREATE CERTIFICATE Cert_Andonpc017_Trans AUTHORIZATION andon
FROM FILE = 'C:Cert_andonpc017_Trans'

--DROP LOGIN sbLogin
CREATE LOGIN sbLogin
FROM CERTIFICATE Cert_Andonpc017_Trans;
GO

GRANT CONNECT ON ENDPOINT::SBEndpointServer TO [public]


GRANT CONNECT ON ENDPOINT::SBEndpointServer TO andon
GO

----------------------------------------------------

USE AndonDB
CREATE ROUTE Grafik_sevapc311
WITH SERVICE_NAME = 'Grafik_Service_Recive_sevapc311',
BROKER_INSTANCE = '7C737F42-2DF6-46E7-A6B6-89D1A9608DE2',
ADDRESS = 'TCP://sevapc311:5723'
GO

--DROP ROUTE Grafik_andonpc017
CREATE ROUTE Grafik_Andonpc017
WITH SERVICE_NAME = 'Grafik_Service_Recive_Andonpc017',
BROKER_INSTANCE = 'AE2B294A-B02E-4709-A51E-CFBFD0E478C1',
ADDRESS = 'TCP://192.168.20.106:5723'
GO



CREATE CERTIFICATE Cert_ROBOTSRV_Dialog
WITH SUBJECT = 'Cert_ROBOTSRV_auth',
START_DATE = '02/15/2007',
EXPIRY_DATE = '02/15/2015'
GO
BACKUP CERTIFICATE Cert_ROBOTSRV_Dialog TO FILE = 'C:Cert_ROBOTSRV_Dialog'
GO

CREATE CERTIFICATE Cert_sevapc311_pub_Dialog AUTHORIZATION andon
FROM FILE = 'C:Cert_sevapc311_Dialog'

--DROP CERTIFICATE Cert_andonpc017_Dialog
CREATE CERTIFICATE Cert_Andonpc017_Dialog AUTHORIZATION andon
FROM FILE = 'C:Cert_andonpc017_Dialog'

GRANT SEND ON SERVICE::[Grafik_Service_Send_ROBOTSRV]
TO andon

CREATE USER sbLogin

GRANT SEND ON SERVICE::[Grafik_Service_Send_ROBOTSRV]
TO sbLogin
GO
--GRANT SEND ON SERVICE::[Grafik_Service_Send_ROBOTSRV]
--TO [VADERSTADvrobot]
--GO

-- Grant RECEIVE permission on the queue.
GRANT RECEIVE ON [Grafik_Queue]
TO andon
GO
GRANT CONTROL ON SERVICE::[Grafik_Service_Send_ROBOTSRV]
TO andon
GO


--DROP REMOTE SERVICE BINDING Grafik_sevap
CREATE REMOTE SERVICE BINDING Grafik_sevap
TO SERVICE 'Grafik_Service_Recive_sevapc311'
WITH USER = andon
GO

--DROP REMOTE SERVICE BINDING Grafik_andonpc017
CREATE REMOTE SERVICE BINDING Grafik_andonpc017
TO SERVICE 'Grafik_Service_Recive_Andonpc017'
WITH USER = andon


€śReceiver 1€?

use master


CREATE MASTER KEY ENCRYPTION BY PASSWORD = 'andonANDON'


CREATE CERTIFICATE Cert_sevapc311
WITH SUBJECT = 'Cert_sevapc311_Auth',
START_DATE = '02/15/2007',
EXPIRY_DATE = '02/15/2015'

GO

BACKUP CERTIFICATE Cert_sevapc311 To FILE = 'C:Cert_sevapc311'

CREATE ENDPOINT SBEndpointklient STATE = STARTED
AS TCP (LISTENER_PORT = 5723)
FOR SERVICE_BROKER (AUTHENTICATION = CERTIFICATE Cert_sevapc311)


CREATE CERTIFICATE Cert_ROBOTSRV_pub AUTHORIZATION andon
FROM FILE = 'C:Cert_ROBOTSRV';

GRANT CONNECT ON ENDPOINT::SBEndpointklient to andon


----------------------------------------------------------------------------------
use KlientDB

GRANT SEND ON SERVICE::[Grafik_Service_Recive_sevapc311]
TO andon
GO

GRANT CONTROL ON SERVICE::[Grafik_Service_Recive_sevapc311]
TO andon
GO

GRANT RECEIVE ON [Grafik_Queue]
TO andon
GO


CREATE Route Grafik_ROBOTSRV
WITH
SERVICE_NAME = 'Grafik_Service_Send_ROBOTSRV',
BROKER_INSTANCE = '2BA192F8-0BA3-4237-A156-21AFF7C65481',
ADDRESS = 'TCP://ROBOTSRV:5723'

CREATE MASTER KEY ENCRYPTION BY PASSWORD = 'andonANDON'


CREATE CERTIFICATE Cert_sevapc311_Dialog
WITH SUBJECT = 'Cert_sevapc311_Auth',
START_DATE = '02/15/2007',
EXPIRY_DATE = '02/15/2015'

GO

BACKUP CERTIFICATE Cert_sevapc311_Dialog To FILE = 'C:Cert_sevapc311_Dialog'


CREATE CERTIFICATE Cert_ROBOTSRV_pub_Dialog AUTHORIZATION andon
FROM FILE = 'C:Cert_ROBOTSRV_Dialog';


€śReceiver 2€?

use master

CREATE MASTER KEY ENCRYPTION BY PASSWORD = 'andonANDON'

--DROP CERTIFICATE Cert_Andonpc017_Trans
CREATE CERTIFICATE Cert_Andonpc017_Trans
WITH SUBJECT = 'Cert_Andonpc017_Auth',
START_DATE = '02/15/2007',
EXPIRY_DATE = '02/15/2015'

GO
BACKUP CERTIFICATE Cert_Andonpc017_Trans To FILE = 'F:Cert_Andonpc017_Trans'

CREATE ENDPOINT SBEndpointklient STATE = STARTED
AS TCP (LISTENER_PORT = 5723)
FOR SERVICE_BROKER (AUTHENTICATION = CERTIFICATE Cert_Andonpc017_Trans)


--DROP USER andon
CREATE USER andon


--DROP CERTIFICATE Cert_ROBOTSRV
CREATE CERTIFICATE Cert_ROBOTSRV AUTHORIZATION andon
FROM FILE = 'C:Cert_ROBOTSRV';

CREATE LOGIN sbLogin
FROM CERTIFICATE Cert_ROBOTSRV;
GO

GRANT CONNECT ON ENDPOINT::SBEndpointklient TO [public]
--Select * from sys.certificates


---------------------------------------------------------------
use KlientDB

create user andon

Grant SEND ON SERVICE::[Grafik_Service_Recive_Andonpc017] to [Public]

GRANT SEND ON SERVICE::[Grafik_Service_Recive_Andonpc017]
TO andon
GO

GRANT CONTROL ON SERVICE::[Grafik_Service_Recive_Andonpc017]
TO andon
GO

GRANT RECEIVE ON [Grafik_Queue]
TO andon
GO


--DROP Route Grafik_ROBOTSRV
CREATE Route Grafik_ROBOTSRV
WITH
SERVICE_NAME = 'Grafik_Service_Send_ROBOTSRV',
BROKER_INSTANCE = '2BA192F8-0BA3-4237-A156-21AFF7C65481',
ADDRESS = 'TCP://ROBOTSRV:5723'

--Dialog Säkerhet
CREATE MASTER KEY ENCRYPTION BY PASSWORD = 'andonANDON'

--Drop CERTIFICATE Cert_Andonpc017_Dialog
CREATE CERTIFICATE Cert_Andonpc017_Dialog
WITH SUBJECT = 'Cert_Andonpc017_Auth',
START_DATE = '02/15/2007',
EXPIRY_DATE = '02/15/2015'

GO

BACKUP CERTIFICATE Cert_Andonpc017_Dialog To FILE = 'F:Cert_Andonpc017_Dialog'

--Drop CERTIFICATE Cert_ROBOTSRV_Dialog
CREATE CERTIFICATE Cert_ROBOTSRV_Dialog AUTHORIZATION andon
FROM FILE = 'C:Cert_ROBOTSRV_Dialog';

View 2 Replies View Related

SQL License Questions And Other Questions &&>&&>&&>&&>

Mar 3, 2006

1.    Is it legal  and OK to use a MSDN SQL copy on a production environment or is it strickly for test environments ??

2.   If I own a legal copy of SQL 7 with 5 cals, can I legally use SQL MSDE and have more than 5 people access my SQL server or am I also limited to 5 users as my original ??

 Sorry I am a newbie at this SQL thing.

View 1 Replies View Related

Encrypt Connection With Certificate

Feb 7, 2007

I have been trying to create a certificate for use with SQL2005. I found openSSL to create a cert but I am not sure how to use it.

When I go into SQL Config Manager / Protocol Properties / Certificate Tab... I do not see any certificates. The list is empty. Where are these certs pulled from and how can I create one on my own?


Here are the Reqs:

Certificate Requirements

For SQL Server 2005 to load a SSL certificate, the certificate must meet the following conditions:

The certificate must be in either the local computer certificate store or the current user certificate store.

The current system time must be after the Valid from property of the certificate and before the Valid to property of the certificate.

The certificate must be meant for server authentication. This requires the Enhanced Key Usage property of the certificate to specify Server Authentication (1.3.6.1.5.5.7.3.1).

The certificate must be created by using the KeySpec option of AT_KEYEXCHANGE. Usually, the certificate's key usage property (KEY_USAGE) will also include key encipherment (CERT_KEY_ENCIPHERMENT_KEY_USAGE).

The Subject property of the certificate must indicate that the common name (CN) is the same as the host name or fully qualified domain name (FQDN) of the server computer. If SQL Server is running on a failover cluster, the common name must match the host name or FQDN of the virtual server and the certificates must be provisioned on all nodes in the failover cluster.

View 3 Replies View Related

SQL 2012 :: SSL With Wildcard Certificate?

Oct 2, 2012

I have SQL Server 2012 and want to encrypt my connections by using a wildcard [URL] ssl certificate from a trusted party. After installing my certificate i want to selecti in in de SQL Server Configuration Manager but the certificate does not appear in the properties of protocols.

In older versions it was possible to add the thumprint of my certificate to the registry, but in this version that result into a sql server that cannot be started anymore.

View 7 Replies View Related

Certificate Private Key Cannot Be Found

Apr 15, 2014

I set up Service broker (2008R2 -> 2012) across different servers and domains using certificates.I set up 2 queues (one for sending, one for receiving).I set up 6 services (3 for send, 3 for receive), all 3 sharing the same queue type. (srv_send_1, srv_send_2, srv_send_3), (srv_receive_1, srv_receive_2, srv_receive_3).I set up a route for each receiving service on the source, and for each sending service on the target.I set up a SB binding to the remote for each sender service type.I granted send rights to the sending services on the source server.

I then tested my first service, and it worked perfectly (still works).My second service however is failing with the error "The certificate's private key cannot be found".I am stumped, as all the setup code was a lot of copy/paste which I have checked, rechecked and even re-coded.Basically, here is what Im doing:

begin dialog @ConversationHandle
FROM Service srv_send_1
TO Service 'srv_receive_1'
ON CONTRACT myContract
WITH ENCRYPTION = OFF, LIFETIME = 60*60*24*7;
SEND ON CONVERSATION @conversationHandle
MESSAGE TYPE [my_msgtype] (@xml);

The above code works 100% with service1, but not with service2.Note that on profiler, the target server doesnt receive any communication. The error shows on the sender profiler.Also, The conversation shows up as CONVERSING in sys.conversation_endpoints and the entry exists in sys.transmission_queue.

View 1 Replies View Related

SQL 2012 :: Certificate And Password Changes

Oct 29, 2015

We are in the process of deploying security software that will change AD service accounts automatically every 90 days. I was wondering if changing the password on accounts used for SSRS certificates will break the certs? Are there any other gotchas we should be concerned about with automated password changes in SQL?

View 2 Replies View Related

Fallback Certificate Error

May 7, 2007

Hello,



I have sql express install on my machine.

I am getting the following error in event log:



Event ID: 17190
FallBack certificate initialization failed with error code: 1.

Event ID: 1
The SQL configuration for SQL is inaccessible or invalid.

Event ID: 2
The configuration of the SQL instance MSSQLServer is not valid.

Event ID: 16
The SQLBrowser is enabling SQL instance and connectivity discovery support.

Event ID: 17
The SQLBrowser is enabling Analysis Services discovery support.

Event ID: 17
The SQLBrowser service has started.





Can you help me please to understand what is wrong?



thank you

garfield1372

View 1 Replies View Related

Problems With New Certificate In SQL ASPNETDB

Oct 29, 2007

Hi,

I am hosting my web app and sql server on the same machine. I recently installed a new certificate on IIS and deleted the old one. Now, when I enter my username and password, i cannot login. I have chacked that "Force Encryption" is not enabled, but when I open the "Certificate" tab in SQL Server 2005 configuration manager, no certificates appear. I have verified that my new certificate is installed by going through mmc and IE. What do I do to fix this??

thanks

kreid

View 1 Replies View Related

Backup CERTIFICATE Fails

Jun 13, 2006

I've problems with backing up the certificate (on the Witness Server). On principal and mirror, it works fine (Win 2003 Server, US English), but on my local PC (XP Prof, German) what i use as witness Server following backup command raises an error:

USE master;

CREATE MASTER KEY ENCRYPTION BY PASSWORD = 'something$Strong123';

CREATE CERTIFICATE HOST_W_cert WITH SUBJECT = 'HOST_W certificate for database mirroring', START_DATE = '01/01/2006', EXPIRY_DATE = '12/31/2050';

BACKUP CERTIFICATE HOST_W_cert TO FILE = 'C:HOST_W_cert.cer';

The error message is:

Msg 15240, Level 16, State 1, Line 1

Cannot write into file 'C:HOST_W_cert.cer'. Verify that you have write permissions, that the file path is valid, and that the file does not already exist.

I connect to the database with a domain user what is a local admin on the witness server (my local user), so this couldn't be a permission reason. The file doesn't already exists, so that is not the problem.

What could it be?

Greetings, Torsten

View 3 Replies View Related

Certificate Creation Problem

Sep 13, 2005

Hello to all

View 3 Replies View Related

Certificate Private Key Recovery

Feb 5, 2008

We are looking to put column level encryption on a table. Great! Wonderful! Look in books online and see that you must give "control" perm to the Certificate for any user that needs to use the symmetric key.

Now my question. I have backed up the Certificate to file. What I have found playing around with the commands is it is possible to run the following command:

Alter Certificate MyCert
Remove private key

BOL says their is no "Restore Certificate" command and to just use "Create Certificate". I have tried this and I keep getting an error saying the certificate already exist in the database.

What have I missed? How can I restore this certificate without restoring the ENTIRE database? Is there a permission set that can be applied to the Certificate to stop thsi kind of command from being run while still having the symmetric key usable? Any help would be of great use!

Thanks,


*note* this is using the MasterKey->Cert->SymmetricKey

View 6 Replies View Related

Create Certificate From Byte[]

Feb 4, 2008

Hi,

Just wondering if anyone knows if you can create a certificate from a byte[]. For example, you can create an assembly using CREATE ASSEMBLY FROM 0x...; specifying the hex representation of it - can you do the same with a certificate? This means that you don't need to save the file to disk before loading it into the database.

Cheers,
Adam

View 3 Replies View Related

Certificate-mapped Logins

Oct 20, 2007

Hello every body
what is certificate-mapped logins? and how we can authenticate with these logins?
thanks

View 1 Replies View Related

Is The Certificate Based Authentication The Only Way ?

Jul 26, 2007





1.On an virtual server two virtual machines of Windows 2003+sql server 2005 developer edition named VM1 and VM2

2.The VMs are not on a domain.

3.endpoint uses windows authentication


I get the following error

Msg 1418, Level 16, State 1, Line 1
The server network address "TCP://x.x.x.x:5022" can not be reached or does not exist. Check the network address name and that the ports for the local and remote endpoints are operational.



and the log file contains the following



07/26/2007 19:21:22,Logon,Unknown,Database Mirroring login attempt failed with error: 'Connection handshake failed. An OS call failed: (8009030e) 0x8009030e(No credentials are available in the security package). State 65.'. [CLIENT: x.x.x.x]
07/26/2007 19:21:19,Logon,Unknown,Database Mirroring login attempt failed with error: 'Connection handshake failed. An OS call failed: (8009030e) 0x8009030e(No credentials are available in the security package). State 65.'. [CLIENT: x.x.x.x]
07/26/2007 19:21:17,Logon,Unknown,Database Mirroring login attempt failed with error: 'Connection handshake failed. An OS call failed: (8009030e) 0x8009030e(No credentials are available in the security package). State 65.'. [CLIENT: x.x.x.x]
07/26/2007 19:21:14,Logon,Unknown,Database Mirroring login attempt failed with error: 'Connection handshake failed. An OS call failed: (8009030e) 0x8009030e(No credentials are available in the security package). State 65.'. [CLIENT: x.x.x.x]
07/26/2007 19:21:12,Logon,Unknown,Database Mirroring login attempt failed with error: 'Connection handshake failed. An OS call failed: (8009030e) 0x8009030e(No credentials are available in the security package). State 65.'. [CLIENT: x.x.x.x]
07/26/2007 19:21:10,Logon,Unknown,Database Mirroring login attempt failed with error: 'Connection handshake failed. An OS call failed: (8009030e) 0x8009030e(No credentials are available in the security package). State 65.'. [CLIENT: x.x.x.x]
07/26/2007 19:21:09,Logon,Unknown,Database Mirroring login attempt failed with error: 'Connection handshake failed. An OS call failed: (8009030e) 0x8009030e(No credentials are available in the security package). State 65.'. [CLIENT: x.x.x.x]
07/26/2007 19:21:08,Logon,Unknown,Database Mirroring login attempt failed with error: 'Connection handshake failed. An OS call failed: (8009030e) 0x8009030e(No credentials are available in the security package). State 65.'. [CLIENT: x.x.x.x]
07/26/2007 19:21:06,spid25s,Unknown,Database mirroring connection error 5 'Connection handshake failed. An OS call failed: (8009030e) 0x8009030e(No credentials are available in the security package). State 65.' for 'TCP://x.x.x.x:5022'.
07/26/2007 19:21:06,spid25s,Unknown,Error: 1474<c/> Severity: 16<c/> State: 1.
07/26/2007 19:21:06,Logon,Unknown,Database Mirroring login attempt failed with error: 'Connection handshake failed. An OS call failed: (8009030e) 0x8009030e(No credentials are available in the security package). State 65.'. [CLIENT: x.x.x.x]



Is there anyway i can do mirroring without certificates,

guys any pointers?

View 7 Replies View Related

Create A Certificate From Hex String

Feb 7, 2008

Hi,

Does anyone know if there's a way to create a certificate from a hex string rather than a backup file? i.e:





Code Snippet

create certificate from 0x123ABC...;

rather than

create certificate from 'C:mycert.cer' (or whatever the syntax is)
I know that you can do this for assemblies (and in fact I use this) - is there an equivalent for certificates? If not, why not?

Cheers,
Adam

View 3 Replies View Related

Certificate Restore Not Working.

Apr 23, 2007



I have been trying to use Encryption to encrypt a few key fields. So my first goal was to create all the items I would need to effectivly use encryption, to encrypt a few key fields.



First I created a sample sql script to create a certificate, create a table and insert some test data encrypted. And then made sure I could decrypt the data encrypted with the certificate.



Second step was to test the backing up of the certificate, droping the certificate to similate a restore of the database. And then a restore of the certificate, and then see if the it was still possible to decrypt the existing encrypted data with the restored certificate.



I receive no errors when restoreing the certificate, but it does not properly decrypt the exisiting data.



Can anyone help and point out my mistake?





--Start Sql----Create Sample Cert
CREATE CERTIFICATE SampleCert1
ENCRYPTION BY PASSWORD = '728AC41753642403251BF8E7233EC0C'
WITH SUBJECT = 'Sample Cert for Demo',
EXPIRY_DATE = '04/18/2017';

--create Sample table with encrypted version
CREATE TABLE Table_1
(Id int NOT NULL IDENTITY (1, 1), SSN_Encrypted varbinary(300) NOT NULL) ON [PRIMARY]
GO

--insert row with encrypted version.
Insert into Table_1
(SSN_Encrypted)
values
(EncryptByCert(Cert_ID('SampleCert1'),'000-00-0000'))

--returns '000-00-0000' for 'SampleCert1' since it was able to decrypt
select SSN_Encrypted, cast(DecryptByCert(Cert_ID('SampleCert1'),SSN_Encrypted,N'728AC41753642403251BF8E7233EC0C') as varchar(12)) as 'SampleCert1'
from Table_1

GO

--backup Certificate
BACKUP CERTIFICATE SampleCert1 TO FILE = 'D:BackupsSampleCert.cer'
WITH PRIVATE KEY
(
FILE = 'D:BackupsSampleCert.pvk' ,
DECRYPTION BY PASSWORD = N'728AC41753642403251BF8E7233EC0C' ,
ENCRYPTION BY PASSWORD = N'997jkhUbhk$w4ez0876hKHJH5gh'
);

GO

DROP CERTIFICATE SampleCert1;

GO

--Restore from backup. to simulate a restore from tape
CREATE CERTIFICATE SampleCert1
FROM FILE = 'D:BackupsSampleCert.cer'
WITH PRIVATE KEY (FILE = 'D:BackupsSampleCert.pvk', DECRYPTION BY PASSWORD = N'997jkhUbhk$w4ez0876hKHJH5gh');

--This should return the same ssn as was encrypted, if returns null the restore failed.
select SSN_Encrypted, cast(DecryptByCert(Cert_ID('SampleCert1'),SSN_Encrypted,N'728AC41753642403251BF8E7233EC0C') as varchar(12)) as 'SampleCert1'
from Table_1

--cleanup Removes Certificate from the system
DROP CERTIFICATE SampleCert1;

--removes the temporary table.
Drop table Table_1

View 6 Replies View Related

Obtain Certificate Co Configure Ssl

Jan 25, 2007

i read from msdn that i need a certificate for me to be able to configure SSL which will allow me to replicate on my publication. it says that i can obtain a certificate from a certification authority (CA). do i have to pay for it?

there is a SelfSSL that i can dowload and use for 7 days have anyone of you tried this before?

thanks a lot:)

View 3 Replies View Related

Error Creating A Certificate

Oct 29, 2007

Hi,


I ran the script below fine in my Dev environment, bit it fails in production. Any ideas?


CREATE ENDPOINT SsbInitiatorEndpoint

STATE = STARTED

AS TCP (LISTENER_PORT = 5022)

FOR SERVICE_BROKER

(

AUTHENTICATION = WINDOWS

)

GO

CREATE MASTER KEY

ENCRYPTION BY PASSWORD = N'mypassword'

GO


CREATE CERTIFICATE SsbInitiatorCertificate

AUTHORIZATION SsbInitiatorUser

FROM FILE = N'D:SysapplMssql2005MSSQL$INSTANCENAMECertificatesSsbInitiator.cer'

WITH PRIVATE KEY

(

FILE = 'D:SysapplMssql2005MSSQL$INSTANCENAMECertificatesSsbInitiator.pvk',

DECRYPTION BY PASSWORD = 'mypassword'

)

GO


The error occurs on the CREATE CERTIFICATE statement:

Msg 15208, Level 16, State 1, Line 1

The certificate, asymmetric key, or private key file does not exist or has invalid format.

I am logged on as a local admin when running the script. The SQL Server service account is also a local admin, and the account I am logged on as is sysadmin in SQL Server. This script works fine in my Dev environment and a separate Pre-Prod environment.

I'm using SQL Server 2005 SP2.

Thanks,
Mark.

View 2 Replies View Related

Certificate Not Found For Second Receiver

Jan 30, 2006

I am trying to test load balancing between multiple broker service instances. I have set up one sender and two receivers. When I tried sending a lot of messages from the sender, I noticed that all messages were being received by receiver 1 alone. While I am able to communicate between sender and receiver 1, I am not able to send message to the second receiver (I stopped the first receiver instance to find this out). I receive the "certificate not found" error in the Profiler for the second receiver. The code for my second receiver is very similar to the first one.

I am dumping in the full code down here. I appreciate if someone can figure out what is wrong. Thanks

Sender:

use [master];
go

create master key encryption by password = 'masterhello1';
go

create certificate TrpCertServ1
with subject = 'TrpCertServer1',
start_date = '06/01/2005';
go

--make sure the cert exist
select * from sys.certificates;
go

--dump out the public key of the cert to a file
--this will then be exchanged with the other instance
--make sure that the path you define below can be accessed
--by sql server. The file needs to be copied over to server 2
BACKUP CERTIFICATE TrpCertServ1
TO FILE = 'c:amitOfficialService BrokercertsTrpCertServ1Pub.cer';
go

--you need to create an endpoint in order to enable communication
--outside of this instance
CREATE ENDPOINT SSB1
STATE = STARTED
AS TCP
(
LISTENER_PORT = 4021
)
FOR SERVICE_BROKER
(
AUTHENTICATION = CERTIFICATE TrpCertServ1,
ENCRYPTION = REQUIRED
);
go

USE master ;
GO

ALTER ENDPOINT SSB1
FOR SERVICE_BROKER ( MESSAGE_FORWARDING = ENABLED,
MESSAGE_FORWARD_SIZE = 10 ) ;
GO

--check that the endpoint has been created
select * from sys.endpoints;
go

--create a login and a user which you eventually will assign a public
--key from the cert in the remote master db to
create login remconnlogin1
with password = 'remserver@1';
go

create user remconnuser1
from login remconnlogin1;
go

--grant connect to the endpoint to the login
grant connect on endpoint::ssb1 to remconnlogin1
go

--now is time to go over to server 2 and do similar tasks
--but first make sure that the cert you dumped out above can be
--available for server 2

--Step 2
-- you have now done the similar setup in server 2,
--and you should now do the final setup in master
--where you create a certificate from server 2's public
--cert and assigns it to the user created above
--uncomment from here to go and execute
create certificate TrpCertServ2Pub
authorization remconnuser1
from file = 'C:amitOfficialService BrokercertsTrpCertServ2Pub.cer';
go

--adding for new receiver
create certificate TrpCertServ3Pub
authorization remconnuser1
from file = 'C:amitOfficialService BrokercertsTrpCertServ3Pub.cer';
go
-- end of addition

use master;
go

--create the database
create database [rem_ssb1];
go

use [rem_ssb1];
go

--set master key
create master key
encryption by password = 'hellodb1';

create certificate DlgCertServ1Db1
with subject = 'DlgCertServ1Db1',
start_date = '06/01/2005'
active for begin_dialog = on;
go

--make sure the cert exist
select * from sys.certificates;
go

--dump out the public key of the cert to a file
--this will then be exchanged with the other instance
--make sure that the path you define below can be accessed
--by sql server. The file needs to be copied over to server 2
BACKUP CERTIFICATE DlgCertServ1Db1
TO FILE = 'c:amitOfficialService BrokercertsDlgCertServ1Db1Pub.cer';
go

--create a user which you eventually will assign a public
--key from the cert in the remote db to
create user remdlguser1
without login;
go


--Step 2
create certificate DlgCertServ2Db2Pub
authorization remdlguser1
from file = 'c:amitOfficialService BrokercertsDlgCertServ2Db2Pub.cer';
go

-- adding content for new receiver
create certificate DlgCertServ3Db3Pub
authorization remdlguser1
from file = 'c:amitOfficialService BrokercertsDlgCertServ3Db3Pub.cer';
go
-- end of addition

use [rem_ssb1];
go

-- we need two message types
CREATE MESSAGE TYPE [sendmsg]
VALIDATION = WELL_FORMED_XML;

CREATE MESSAGE TYPE [recmsg]
VALIDATION = WELL_FORMED_XML;
go

--create the message contract
--and define who sends what
CREATE CONTRACT [Ctract]
(
[sendmsg]
sent by initiator,
[recmsg]
sent by target
);
go

--create the queue, at this stage we do not care
--about activation
CREATE QUEUE q1
with status = ON;
go

--we need a service
CREATE SERVICE [rem_s1]
on queue q1
(
[Ctract]
);
go

--create a route to the remote service, we know it'll be called rem_s2
create route [rem_s2_route]
with
service_name = 'rem_s2',
address = 'TCP://127.0.0.1:4022';
go
--drop route [rem_s2_route]

-- adding for new route
create route [rem_s3_route]
with
service_name = 'rem_s2',
address = 'TCP://127.0.0.1:4023';
go
-- end of addition

select * from sys.routes

--as we'll be doing encrypted dialogs we need a remote service bindin
CREATE REMOTE SERVICE BINDING [myRms]
TO SERVICE 'rem_s2'
WITH USER = remdlguser1,
ANONYMOUS=Off

--give the user send rights on the service
grant send on service::rem_s1 to remdlguser1;
go
use [rem_ssb1];
go

----start the dialog and send a message
----uncomment from here until the following go statement and run
DECLARE @h uniqueidentifier --conversation handle
DECLARE @msg xml; --will hold the message

BEGIN DIALOG CONVERSATION @h
FROM SERVICE rem_s1
TO SERVICE 'rem_s2'
ON CONTRACT [Ctract];

SET @msg = '<hello00/>';
SEND ON CONVERSATION @h
MESSAGE TYPE [sendmsg]
(@msg);


RECEIVER 1:


--Step 1

use [master];
go

create master key encryption by password = 'masterhello2';
go

create certificate TrpCertServ2
with subject = 'Transport Certificate for Server2',
start_date = '06/01/2005';
go

--make sure the cert exist
select * from sys.certificates;
go

--dump out the public key of the cert to a file
--this will then be exchanged with the other instance
--make sure that the path you define below can be accessed
--by sql server. The file needs to be copied over to server 1
BACKUP CERTIFICATE TrpCertServ2
TO FILE = 'c:amitOfficialService Brokercerts2TrpCertServ2Pub.cer';
go

--you need to create an endpoint in order to enable communication
--outside of this instance

CREATE ENDPOINT SSB2
STATE = STARTED
AS TCP
(
LISTENER_PORT = 4022
)
FOR SERVICE_BROKER
(
AUTHENTICATION = CERTIFICATE TrpCertServ2,
ENCRYPTION = REQUIRED
);
go

--check that the endpoint has been created
select * from sys.endpoints;
go

--create a login and a user which you eventually will assign a public
--key from the cert in the remote master db to
create login remconnlogin2
with password = 'pass1234$';
go

create user remconnuser2
from login remconnlogin2;
go

--grant connect on the endpoint to the login
grant connect on endpoint::SSB2 to remconnlogin2
go

--copy in the public cert from server 1 to somewhere on this server

--create a certificate from the public cert from server 1
create certificate TrpCertServ1Pub
authorization remconnuser2
from file = 'c:amitOfficialService Brokercerts2TrpCertServ1Pub.cer';

--go back to server 1 and step 2 in the script 1_setup_sec_master_server1.sql
--make sure the public cert 'TrpCertServ2Pub.cer' is available
--from server 1

use master;
go

--create the database
create database [rem_ssb2];
go

use [rem_ssb2];
go

--set master key
create master key
encryption by password = 'hellodb2';
go

create certificate DlgCertServ2Db2
with subject = 'DlgCertServ2Db2',
start_date = '06/01/2005'
active for begin_dialog = on;
go

--make sure the cert exist
select * from sys.certificates;
go

BACKUP CERTIFICATE DlgCertServ2Db2
TO FILE = 'c:amitOfficialService Brokercerts2DlgCertServ2Db2Pub.cer';
go

create user remdlguser2
without login;
go

--copy in the public cert from server 1 to somewhere on this server

--create a certificate from the public cert from server 1
create certificate DlgCertServ1Db1Pub
authorization remdlguser2
from file = 'c:amitOfficialService Brokercerts2DlgCertServ1Db1Pub.cer';
use [rem_ssb2];
go

-- we need two message types
CREATE MESSAGE TYPE [sendmsg]
VALIDATION = WELL_FORMED_XML;

CREATE MESSAGE TYPE [recmsg]
VALIDATION = WELL_FORMED_XML;
go

--create the message contract
--and define who sends what
CREATE CONTRACT [Ctract]
(
[sendmsg]
sent by initiator,
[recmsg]
sent by target
);
go

--create the queue, at this stage we do not care
--about activation
CREATE QUEUE q2
with status = ON;
go

--we need a service
CREATE SERVICE [rem_s2]
on queue q2
(
[Ctract]
);
go

--create a route to the remote service, we know it'll be called rem_s1
create route [rem_s1_route]
with
service_name = 'rem_s1',
--broker_instance = 'D8EE8A81-F1B0-46B3-BBEB-70F19EF59083',
address = 'TCP://127.0.0.1:4021';
go

--as we'll be doing encrypted dialogs we need a remote service binding
--and the user is the user we created in the 2_setup_objects_server2_db.sql scripts
CREATE REMOTE SERVICE BINDING [myRms]
TO SERVICE 'rem_s1'
WITH USER = remdlguser2,
ANONYMOUS=Off
go

--give the user send rights on the service
grant send on service::rem_s2 to remdlguser2;
go
SELECT * from q2;

RECEIVER 2:

use [master];
go

--make sure master had master key
create master key encryption by password = 'masterhello2';
go

create certificate TrpCertServ3
with subject = 'Transport Certificate for Server3',
start_date = '06/01/2005';
go

--make sure the cert exist
select * from sys.certificates;
go

BACKUP CERTIFICATE TrpCertServ3
TO FILE = 'c:amitOfficialService Brokercerts3TrpCertServ3Pub.cer';
go

--you need to create an endpoint in order to enable communication
--outside of this instance

CREATE ENDPOINT SSB3
STATE = STARTED
AS TCP
(
LISTENER_PORT = 4023
)
FOR SERVICE_BROKER
(
AUTHENTICATION = CERTIFICATE TrpCertServ3,
ENCRYPTION = REQUIRED
);
go

--check that the endpoint has been created
select * from sys.endpoints;
go

--create a login and a user which you eventually will assign a public
--key from the cert in the remote master db to
create login remconnlogin3
with password = 'pass1234$';
go

create user remconnuser3
from login remconnlogin3;
go

--grant connect on the endpoint to the login
grant connect on endpoint::SSB3 to remconnlogin3
go

--copy in the public cert from server 1 to somewhere on this server

--create a certificate from the public cert from server 1
create certificate TrpCertServ1Pub
authorization remconnuser3
from file = 'c:amitOfficialService Brokercerts3TrpCertServ1Pub.cer';
use master;
go

--create the database
create database [rem_ssb3];
go

use [rem_ssb3];
go

--set master key
create master key
encryption by password = 'hellodb3';
go

create certificate DlgCertServ3Db3
with subject = 'DlgCertServ3Db3',
start_date = '06/01/2005'
active for begin_dialog = on;
go

--make sure the cert exist
select * from sys.certificates;
go

BACKUP CERTIFICATE DlgCertServ3Db3
TO FILE = 'c:amitOfficialService Brokercerts3DlgCertServ3Db3Pub.cer';
go

--create a user which you eventually will assign a public
--key from the cert in the remote db to
create user remdlguser3
without login;
go

--copy in the public cert from server 1 to somewhere on this server

--create a certificate from the public cert from server 1
create certificate DlgCertServ1Db1Pub
authorization remdlguser3
from file = 'c:amitOfficialService Brokercerts3DlgCertServ1Db1Pub.cer';

--create the message contract
--and define who sends what
CREATE CONTRACT [Ctract]
(
[sendmsg]
sent by initiator,
[recmsg]
sent by target
);
go

--create the queue, at this stage we do not care
--about activation
CREATE QUEUE q2
with status = ON;
go

--we need a service
CREATE SERVICE [rem_s2]
on queue q2
(
[Ctract]
);
go

--create a route to the remote service, we know it'll be called rem_s1
create route [rem_s1_route]
with
service_name = 'rem_s1',
--broker_instance = 'D8EE8A81-F1B0-46B3-BBEB-70F19EF59083',
address = 'TCP://127.0.0.1:4021';
go

--as we'll be doing encrypted dialogs we need a remote service binding
--and the user is the user we created in the 2_setup_objects_server2_db.sql scripts
CREATE REMOTE SERVICE BINDING [myRms]
TO SERVICE 'rem_s1'
WITH USER = remdlguser3,
ANONYMOUS=Off
go

--give the user send rights on the service
grant send on service::rem_s2 to remdlguser3;
go

select * from q2

View 7 Replies View Related







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