473,320 Members | 1,865 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

encrypt password column by keeping its data type varchar

Expand|Select|Wrap|Line Numbers
  1. encrypting coloumn ..hiding password charecter 
  2.  
  3.  
  4. use CRM 
  5. create table h1
  6. (
  7. uname varchar(20) null,
  8. pwd varchar(20) null,
  9. [Encryptedpwd] varbinary(200) null
  10. )
  11.  
  12.  
  13. insert into h1 
  14. values ('teee' , 'cccc' , null)
  15.  
  16. CREATE MASTER KEY ENCRYPTION BY 
  17. PASSWORD = 'mypassword'
  18. GO
  19.  
  20.  
  21.  
  22. CREATE CERTIFICATE crm
  23.    WITH SUBJECT = 'pwd Encryption';
  24. GO
  25.  
  26. CREATE SYMMETRIC KEY  HRKey
  27.     WITH ALGORITHM = DES
  28.     ENCRYPTION BY CERTIFICATE crm;
  29. GO
  30.  
  31. OPEN SYMMETRIC KEY HRKey
  32.    DECRYPTION BY CERTIFICATE crm;
  33.  
  34.  
  35.    UPDATE [h1]
  36.    SET [Encryptedpwd] = EncryptByKey(Key_GUID('HRKey'), pwd );
  37. GO
  38.  
  39. use CRM 
  40. OPEN SYMMETRIC KEY HRKey
  41.    DECRYPTION BY CERTIFICATE crm;
  42. SELECT pwd, 
  43.     CONVERT(VARCHAR, DecryptByKey([Encryptedpwd])) 
  44.     AS 'Decrypted pwd'
  45.     FROM [h1]
  46. GO
pwd is the coloum containing the password i encrypted this to new coloumn but ..i want to encrypt the pwd coloumn only by keepin its data type varchar can anyone support ...please for that
Jan 6 '13 #1
6 9046
NeoPa
32,556 Expert Mod 16PB
My best guess is that the OP is looking for a way to encrypt string data before saving that away in his [PWD] column. I have no idea what "by keepin its data type varchar" means.

The best I can do at this stage is to link to a couple of articles on encryption. How they would be incorporated into T-SQL is something I can't help with (AES Encryption Algorithm for VBA and VBScript; RC4 Encryption Algorithm for VBA and VBScript; SHA2 Cryptographic Hash Algorithm for VBA and VBScript).
Jan 6 '13 #2
Rabbit
12,516 Expert Mod 8TB
I don't see any reason whatsoever to store the encrypted data in a character format. It's going to be mostly human-unreadable anyways so what's the point?
Jan 7 '13 #3
@rabbit the point is that later from the front end the user name and password should be there for getting login
Jan 9 '13 #4
@NeoPa thanks for the links
Jan 9 '13 #5
Rabbit
12,516 Expert Mod 8TB
You can get it for login anyways. There's no need to store the encrypted data in character format.
Jan 9 '13 #6
NeoPa
32,556 Expert Mod 16PB
Syed:
the point is that later from the front end the user name and password should be there for getting login
Would it not make more sense to store the information as to who the user is, rather than what their security credentials are. I'm not sure I really follow your logic here.

I can imagine you may need to connect to tables from some other BE at some point, but even then having it in any format other than the one the BE requires is pointless surely.

Maybe I misunderstand you completely, but certainly your explanation makes no sense to me.
Jan 9 '13 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Anthony | last post by:
I have an inventory database that Im trying to create a report out of the IP address are a lookup on a seperat table but I keep getting the above error can I change the table row to something to...
1
by: jaYPee | last post by:
I have created a stored procedure that contain this field (below) in order to meet certain criteria. But my problem is when I try to run the stored procedure I encounter an error "Error converting...
10
by: Jane | last post by:
Does any one know why this statement is failing? db2 => ALTER TABLE ELMT_T ALTER COLUMN CDTY_CD SET DATA TYPE VARCHAR(51) DB21034E The command was processed as an SQL statement because it was...
5
by: Hardy Wang | last post by:
Hi all, I am just wandering, is it possible to programmatically detect each column's data type of SalDataReader, DataSet.Tables, DataTable? Thanks for any suggestion! -- WWW:...
1
by: luna | last post by:
got so far then it broke and i cant get it working again - it was updating fine but not inserting and now im getting a "Error converting data type varchar to numeric" which i didnt have before.......
0
by: Elmo Watson | last post by:
I am having all kinds of problems with a Stored Proc I'm trying to run, with the error I'm getting above. First - the way I'm reading it - the database EXPECTS a TinyInt - and it thinks I'm...
0
by: jjtechy | last post by:
The data like 0.06234 that is imported from another server is getting changed as 6.234....E-2 in my local.it is looking as 0.06234 in that server.The datatype of that column is varchar(50) in both...
0
by: guest1 | last post by:
seems to be a problem in my first case stmt here i need to convert this and i dont know how, hope somebody can help me out select distinct top 10 tplan.plan_long_nm, asset.ast_cntr_pol_num,...
3
by: lornab | last post by:
Hi I wonder if anyone can help - I think the answer is simple but it's been a really long day and I need to get this done!! My select statement goes like this... SELECT client, ...
5
AAPWM
by: AAPWM | last post by:
Hello My job is to extract data from my companies database with Crystal Reports, export that data to Excel, modify the data, save the data as "Text "tab delimited"", and upload to the database...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.