encrypting a sql server field to be used with entity framework

Posted on 2012-08-24
Last Modified: 2012-08-24

I have some fields in my sql server 2008 database that I would like to be able to encrypt.

I will then be accessing these fields with entity framework and c#.

How can I do this?

The types of fields I will be wanting to encrypt are things like address etc so they cannot be viewed from within the db?

Thanks in advance.
Question by:scm0sml
    LVL 53

    Expert Comment

    Security Considerations (Entity Framework)
    LVL 53

    Accepted Solution

    You can use AES Encryption (2 way encryption). When you need to query the db you can send the encrypted string that can represent the target value.

    You can create an Extension to Decrypt the Entity.

    MyTableEntitiesSet.Where(c=>c.MyField == MySeekValue.Encrypt()).First().Decrypt(); This can do a database query.

    Be aware of data size, encrypted data is larger...

    LVL 53

    Expert Comment

    Entity Framework And Encrypted Fields

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Should I Do With This Threat Intelligence?

    Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

    Suggested Solutions

    Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
    Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now