2

Can Simple Membership user accounts be created from SQL Server Management Studio?

The only methods I have found for User/Account creation are in C# when running a application:

WebSecurity.CreateUserAndAccount("userName", "password",
                        new
                        {
                            ...
                        }, false);

Is there any way to generate a hashed password that can be used in Simple Membership with t-SQL? Are the requirements for a Simple Membership hashed password known? I have found other methods for generating the password with the DefaultMembershipProvider, but the passwords are not compatible with Simple Membership.

EDIT: I was hoping to find a process similar to this:

declare @salt nvarchar(128)
declare @password varbinary(256)
declare @input varbinary(512)
declare @hash varchar(64)

-- Change these values (@salt should be Base64 encoded)
set @salt = N'eyhKDP858wdrYHbBmFoQ6DXzFE1FB+RDP4ULrpoZXt6f'
set @password = convert(varbinary(256),N'mypassword')

set @input = hashbytes('sha1',cast('' as  xml).value('xs:base64Binary(sql:variable(''@salt''))','varbinary(256)') + @password)
set @hash = cast('' as xml).value('xs:base64Binary(xs:hexBinary(sql:variable(''@input'')))','varchar(64)')

that could be used for Simple Membership.

1 Answer 1

2

I think the easiest way would be to create then import a simple .NET assembly and use it in Sql Server.
http://msdn.microsoft.com/en-us/library/ms189876.aspx

Membership Services use configurations of system and encryption libraries of .NET to generate one-way hashes AFAIK, so it would not be trivial to redo the same thing in t-sql.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.