SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


ENCRYPTBYPASSPHRASE Output Length Difference


ENCRYPTBYPASSPHRASE Output Length Difference

Author
Message
DB_Newbie2007
DB_Newbie2007
Hall of Fame
Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)

Group: General Forum Members
Points: 3711 Visits: 1394
We noticed there is a difference in the length of the output from SQL Server 2008 and 2014 versus 2017. When running the following:

select LEN(ENCRYPTBYPASSPHRASE('JohnSmith', '1' ) )

SQL Server 2008/2014 return a 28 character result.
SQL Server 2017 returns a 36 character result.

Anyone know why?

Argue for your limitations, and sure enough they're yours (Richard Bach, Illusions)
Steve Jones
Steve Jones
SSC Guru
SSC Guru (562K reputation)SSC Guru (562K reputation)SSC Guru (562K reputation)SSC Guru (562K reputation)SSC Guru (562K reputation)SSC Guru (562K reputation)SSC Guru (562K reputation)SSC Guru (562K reputation)

Group: Administrators
Points: 562431 Visits: 20826
No idea, but I'll try to track this down.

Follow me on Twitter: @way0utwest
Forum Etiquette: How to post data/code on a forum to get the best help
My Blog: www.voiceofthedba.com
Steve Jones
Steve Jones
SSC Guru
SSC Guru (562K reputation)SSC Guru (562K reputation)SSC Guru (562K reputation)SSC Guru (562K reputation)SSC Guru (562K reputation)SSC Guru (562K reputation)SSC Guru (562K reputation)SSC Guru (562K reputation)

Group: Administrators
Points: 562431 Visits: 20826
One other note, I get two different encryption values:

2017 - 0x02000000A584538F00817EFA13FB8E176BC435F7FD2A3AEDC9E79AFD2DD203B1356DB2CE
2016 - 0x01000000CBBF1DA4C95CABB66EDE087B7EA983C599D663DB2DA80D49
2017 seems to decrypt 2016, but not vice versa. Need to test more, but this could be an issue.

Nice catch.

Follow me on Twitter: @way0utwest
Forum Etiquette: How to post data/code on a forum to get the best help
My Blog: www.voiceofthedba.com
Steve Jones
Steve Jones
SSC Guru
SSC Guru (562K reputation)SSC Guru (562K reputation)SSC Guru (562K reputation)SSC Guru (562K reputation)SSC Guru (562K reputation)SSC Guru (562K reputation)SSC Guru (562K reputation)SSC Guru (562K reputation)

Group: Administrators
Points: 562431 Visits: 20826
Here you go: https://support.microsoft.com/en-sg/help/4053407/sql-server-2017-cannot-decrypt-data-encrypted-by-earlier-versions

Follow me on Twitter: @way0utwest
Forum Etiquette: How to post data/code on a forum to get the best help
My Blog: www.voiceofthedba.com
DB_Newbie2007
DB_Newbie2007
Hall of Fame
Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)

Group: General Forum Members
Points: 3711 Visits: 1394
Thanks immensely, Steve! I sent the information to our development team so they can make the appropriate modifications to our table(s) and code.

I love surprises but *not* "gotchas". LOL

Argue for your limitations, and sure enough they're yours (Richard Bach, Illusions)
Steve Jones
Steve Jones
SSC Guru
SSC Guru (562K reputation)SSC Guru (562K reputation)SSC Guru (562K reputation)SSC Guru (562K reputation)SSC Guru (562K reputation)SSC Guru (562K reputation)SSC Guru (562K reputation)SSC Guru (562K reputation)

Group: Administrators
Points: 562431 Visits: 20826
You are welcome and hope things work out. If you're interested, this would make a great short article for you to publish.

Follow me on Twitter: @way0utwest
Forum Etiquette: How to post data/code on a forum to get the best help
My Blog: www.voiceofthedba.com
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum








































































































































































SQLServerCentral


Search