Showing posts with label credit. Show all posts
Showing posts with label credit. Show all posts

Friday, February 24, 2012

Best approach to encrypt data?

Hi,

I want to encrypt certain data like password, ssn, credit card info etc before saving in database. Also, this encrypted data can be queried using standard SQL statements like:

select * from users where userid=454 and password = 'encrypted data'

The mechanism to encrypt data could be in a .net application. The code that does encryption/decryption should also be protected so that it doesnt work if it falls in wrong hands.

Can anyone suggest what would be the best way to accomplish above?

thanks,
dapi

You can start with the following links

http://www.microsoft.com/technet/prodtechnol/sql/2005/sqlencryption.mspx

http://articles.techrepublic.com.com/5100-22-5083541.html

Hope this helps

|||

I would suggest reading "Writing Secure Code", Chapter 6. It has a number of examples of how to encrypt data on a Windows platform, and where people make common mistakes. The book is fairly cheap ($0.10 per page) and probably available at the library. I understand C# has a rather extensive crypto library, but knowing how and why is probably better than just "plugging and chugging".

Hope that helps,

John

Monday, February 13, 2012

Beginners question to coding

ok this is for a class assignment so if anyone doesnt want to help thats cool, but its just a small extra credit assignment and we havent gone over it in class and and the book, well is confusing to say the least so here are my questions:

What is the total weight of different colored parts?

ok so i have a parts table, with pcolor and pweight in it but i am unsure how to code that, here is kinda what i think it might be, i have no real way to check to see if it is correct though:

Select sum pweight
from parts
where distinct pcolor

looks horribly wrong so any help is appreciated. here is another one:

What colored part has total weight greater than 8 units?

select pcolor
from parts
where sum pweight > 8

?
i dunno lol.

there is a hint that says to use "GROUP BY" and "HAVING" but i dont see how that fits in... any ideas?I'll put the keywords in the proper order; you figure out the rest:

SELECT
FROM
WHERE
GROUP BY
HAVING

Notes:
1. I don't think you need the WHERE clause in this particular exercise at all.
2. You won't need HAVING in the first part

HAVING was just so totally cool when I first learned how to use it. It is enormously useful at times.

Regards,

hmscott|||This is a super intro to SQL - you will figure out your answers in no time:
http://www.w3schools.com/sql/sql_intro.asp

I'll give you another hint - no need for distinct.