c# - How to get encrypted records from table in sql server by symmetryk key using sqlserver.management.smo -
i using symmetrickey password field. , want records table decrypted passwords. , using microsoft.sqlserver.management.smo.
var tbls = new table(); tbls = db.tables[tblname]; scriptingoptions options = new scriptingoptions(); options.scriptdata = true; options.scriptdrops = false; options.enforcescriptingoptions = true; options.scriptschema = false; options.includeheaders = true; options.appendtofile = true; options.indexes = true; options.withdependencies = true; serverversion sv = new serverversion(2008, 2005); options.settargetserverversion(sv); var script = tbls.enumscript(options); string queryes =""; foreach (var line in script) { if (line.contains("values")) { queryes += line; } }
how decrypted record's data?
if field had been encrypted using symmetric key, should open symmetric key using below statement.
open symmetric key [key name] decryption [decryption mechanism]
the following link may understand symmetric key, asymmetric key , creating certificates encrypt & decrypt data. [https://msdn.microsoft.com/en-us/library/ms190499.aspx]
Comments
Post a Comment