Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Encryption in SQL

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 271
    Comment on it

    For providing security and privacy we need to store data in encrypted form.

    In SQL this can be done with series of steps:

    CREATE TABLE dbo.Employees(
          EmployeeID     int primary key,
          EmployeeName    varchar(50) NULL,
            normaldata          [varchar](20) NOT NULL,
         encrydata    [varbinary] (200) NULL)
    

    Create the Symmetric Key and associate certificate for encryption and providing type of encryption to be done.

    CREATE CERTIFICATE TestCert
       WITH SUBJECT = 'Data Encryption';
    
    
    CREATE SYMMETRIC KEY MyKey
        WITH ALGORITHM = DES
        ENCRYPTION BY CERTIFICATE TestCert;
    
    OPEN SYMMETRIC KEY MyKey
       DECRYPTION BY CERTIFICATE TestCert;
    
    UPDATE dbo.Employees
       SET Data = EncryptByKey(Key_GUID("MyKey'), data);
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: