Password Protection != Encryption on SqlCe

Published Thu, Jan 25 2007 3:50 | William

I know this probably seems pretty obvious, but believe it or not, it's a very common area of confusion.  Take a look at the following declaration:

String ConnectionString = String.Format(@"Data Source=\BlueCuckoo.sdf;password={0}", "SomeValue");

SqlCeEngine

engine.CreateDatabase();

If I asked, "Will this database be encrypted?" you should hopefully answer "No" b/c I gave away the answer in the title. However on more than a few occassions, i've seen people assume that it was.  If you don't explicitly add Encrypt  = True - it isn't going to be encrypted.  And just in case you're wondering "Well, what if I want to encrypt the database but not password protect it?" , well, you wouldn't seriously ask me something like that right? 

Comments

# mrpeabody said on January 25, 2007 9:09 PM:

Hmm... Actually it doesn't seem obvious Bill..

Having bought your ebook on SQLCE 2005 and read "If you specify a password, encryption is automatically enabled on the database" on page 38.. I'm bloomin' confused.

Is there a contradiction here, or am I missing a point somewhere along the way?

Cheers

# William said on January 25, 2007 10:48 PM:

Hi Mr. Peabody.

I think you might have me confused - I haven't written anything on Sql CE other than blog posts.

Anyway, sorry for any confusion.  Anyway, directly from the documentation on it...

Using SQL Syntax

To create an encrypted database through SQL syntax, specify both database_password and the ENCRYPTION ON option.

Anyway, it doesn't.  Here's how you can prove it. Go to Server Explorer and create a new SqlMobile, CE 2005, Express database.  Specify a password and press the Create Button.  Right there, front and center, you'll notice the Encrypt option just waiting to be checked.

However, in the name of being thorough and b/c I don't want to steer you down the wrong direction, I'll actually try to pull a db apart and verify. If I'm wrong on this, a few of us MVPS are in a lotta trouble ;-)

Shoot me your email if you want and I'll make sure you're in the loop - otherwise i'll just post the results here.

Search

This Blog

Tags

Community

Archives

News

My other sites

Cool Stuff

Book Stuff

Security

ORM

Data Access

Funny Stuff

Compact Framework Stuff

Web Casts

My KnowledgeBase Articles

My MVP Profile

Design Patterns

Performance

Debugging

Remoting

My Fellow Authors

My Books

LINQ

Misc

Speech

Syndication

Email Notifications