.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
MarieAdela
Imran Ghani
Post New Web Links

How to use the public key of asymmetric keys?

Posted By:      Posted Date: September 18, 2010    Points: 0   Category :Sql Server
 
Hi All, I know about the concept of public/private keys,but I cannot figure out the difference between asymmetric keys and symmetric keys encrypted by certificates . Both public/private keys are kept at server side ,like a symmetric key encrypted by a certificate How can i use the public key shown as the result of running the following query? select [name] ,asymmetric_key_id,public_key from sys.asymmetric_keys How can it be used when there exists only two pair of functions(EncryptByAsymKey and DecryptByAsymKey)  ? --yousef


View Complete Post


More Related Resource Links

Error generating Asymmetric Keys

  

Hi

I'm working on an SQL Server 2005 DB (SQL Server Standard Edition - Version 9.00.4035.00)

 

I've been told the server that the database is running Microsoft 2003.

When I look in SQL Server DB properties it says Operating System = Microsoft Windows NT 5.2 (3790)

Looking at the operating system details on the server MS Windows 2003 Standard Edition, 5.2.3790 Service Pack 2 Build 3790.

If I create symmetric keys using the following statement everything works fine

CREATE SYMMETRIC KEY TestTableKey2
WITH ALGORITHM = AES_256 ENCRYPTION
BY CERTIFICATE EncryptTestCert

If I try to create an asymmetric keys using the following statement

CREATE ASYMMETRIC KEY TestTableKey3
    WITH ALGORITHM = AES_256
    ENCRYPTION BY PASSWORD = '#1_2%3*4)5~6';

I get the following error :

Msg 15314, Level 16, State 1, Line 1
Either no algorithm has been specified or the bitlength and the algorithm specified for the key are not available in this installation of Windows.

I know that AES encryption will only work on Windows 2003 which is what people say is the reason for the error message.

Is that the case here, I can use the AES_256 encryption when creating symmetric keys, but only get the error when creating an asymmetric key.

Thanks

Using SQL Server 2005 Public Keys in VB.Net

  
I'm creating an asymmetric key in SQL Server:

              CREATE ASYMMETRIC KEY MY_KEY
                            WITH ALGORITHM = RSA_512
                            ENCRYPTION BY PASSWORD = 'password1@'

I'm then taking the public key...

              SELECT public_key
                            FROM sys.asymmetric_keys
                            WHERE [name] = 'MY_KEY'

I'm trying to import this into VB.Net using RSACryptoServiceProvider.

              Dim RSA As New
Security.Cryptography.RSACryptoServiceProvider(512)
              RSA.ImportCspBlob(KeyBlobByteArray)

I have to add the following line to get it to not give me errors.
(Why?) But the data looks right when I look at the exponet and modulus
of the parameters that are exported and then immediately imported.
Something is obviously being thrown away when I do this, but I don't
know what. It's probably the key to the whole problem.

              RSA.ImportParameters(RSA.ExportParameters(False))

I encrypt the message...

              EncryptedMessageByteArray = RSA.Encrypt(MessageByteArray,
False)

And in SQL server I try to decrypt the message and I get NULL.

              SET @DecryptedMessage =
                         

Importing the public key of asymmetric key object into RSACryptoServiceProvider

  

I want to use the public key provided by creating SQL asymmetric key Object
in my VB.Net,After searching the Internet i reached the
Using SQL Server 2005 Public Keys in VB.Net thread.
Now the question is How can I use the public key in RSACryptoServiceProvider   ?
 

--yousef

Surrogate vs Natural Primary Keys - Data Modeling Mistake 2 of 10

  
In case you're new to the series I've compiled a list of ten data modeling mistakes that I see over and over that I'm tackling one by one. I'll be speaking about these topics at the upcoming IASA conference in October, so I'm hoping to generate some discussion to at least confirm I have well founded arguments.

The last post in this series Referential Integrity was probably less controversial than this one. After all, who can argue against enforcing referential integrity? But as obvious as surrogate keys may be to some, there is a good deal of diversity of opinion as evidenced by the fact that people continue to not use them.

Visual Studio Shortcut Keys

  
The following tables describe the shortcut keys in the Microsoft Dynamics AX Debugger.

Public Shared function doubt????

  
Hi
I am using VB.net/ASP.NET and SQL Server 2000 for a web application.

For populating the dropdowns, I wrote a Public Shared function LoadDDL(), in which I pass the dataset and dropdown name to set.

I have my doubts that this function will produce unexpected results for concurrent users. And will mix the results among sessions because it is a Shared function.

I am confused here. Is it the right way to go?

Please advice. Thanks in advance.

Pankaj

NUnit and public static readonly

  

I have an app that I am testing with NUNit.  The project im testing has several helper classes that are created as public static readonly.  When I run the NUnit tests, they all fail with the same error


Systems.Code.Test.TransactionTest.CreateDataContext_ConnectionString_ReturnsDataContextObject:
SetUp : System.TypeInitializationException : The type initializer for 'Systems.Utils.ConstantHelpers' threw an exception.
  ----> System.NullReferenceException : Object reference not set to an instance of an object.
Systems.Code.Test.TransactionTest.CreateDataContext_ConnectionString_ReturnsDataContextObject:
SetUp : System.TypeInitializationException : The type initializer for 'Systems.Utils.ConstantHelpers' threw an exception.
  ----> System.NullReferenceException : Object reference not set to an instance of an object.

I kept getting this error despite stripping out all

The XML Files: XSLT Keys, Select vs. Match, Conflict Resolution, and More

  

This month Aaron Skonnard covers how keys work in XSLT, XSLT match and select attributes, SelectNodes order, finding