can't create account with hashed password

48 views
Skip to first unread message

Chris Heath

unread,
May 2, 2012, 4:04:07 PM5/2/12
to google-app...@googlegroups.com

I am trying to create an account using a hashed password instead of a plaintext password.  I am pulling the sha-1 hash value out of a RH Enterprise Directory Server.  Problem is that I can't get the syntax quite right.  I have tried every variation I can think of.  Here is some test code I tried and all 48 cases failed.  Anybody have any ideas?

    {
        MultiDomainManagementService mdms = GoogleHelper.GetMDMS("example.edu");
        AppsExtendedEntry eUser;
        string sDomain = "southalabama.edu", sMail = "test...@example.edu";
        string[] asPasswords = new string[] { "2bX8XF9kC0kDIMdlYBDxhZmu624E29SDmTY7CA", "{SSHA}2bX8XF9kC0kDIMdlYBDxhZmu624E29SDmTY7CA==", "2bX8XF9kC0kDIMdlYBDxhZmu624E29SDmTY7CA==", "{SSHA}2bX8XF9kC0kDIMdlYBDxhZmu624E29SDmTY7CA" };
        string[] asHashFuncs = new string[] { "SHA-1", "SHA1", "SSHA", "sha-1", "sha1", "ssha", "{SHA-1}", "{SHA1}", "{SSHA}", "{sha-1}", "{sha1}", "{ssha}" };
        int iFails = 0;
        bool bDoBreak = false;
        foreach (string sPassword in asPasswords)
        {
            foreach (string sHashFunc in asHashFuncs)
            {
                try
                {
                    eUser = mdms.CreateDomainUser(sDomain, sMail,
                        sPassword, sHashFunc,
                        "firstName", "LastName", false);

                    //eUser = mdms.CreateDomainUser(sDomain, sMail,
                    //    sPassword,
                    //    "firstName","LastName",false);
                    Master.NoteText("this worked: sPassword=|" + sPassword + "|, HashFunc=|" + sHashFunc + "|");
                    bDoBreak = true;
                    break;
                }
                catch
                {
                    iFails++;
                }
            }
            if (bDoBreak)
                break;
        }
        Master.NoteText("fails=" + iFails.ToString());
    }

 

 

Claudio Cherubino

unread,
May 2, 2012, 4:19:21 PM5/2/12
to google-app...@googlegroups.com
Hi Chris,

There's a sample application in the library showing how to create users in a multi-domain environment:


Also, check this thread for some C# code to compute the SHA-1 hash:


Claudio

 

 

--
You received this message because you are subscribed to the Google Groups "Google Apps Domain Information and Management APIs" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-apps-mgmt-apis/-/dAKrSME9eRIJ.
To post to this group, send email to google-app...@googlegroups.com.
To unsubscribe from this group, send email to google-apps-mgmt...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-apps-mgmt-apis?hl=en.

Chris Heath

unread,
May 2, 2012, 5:56:36 PM5/2/12
to google-app...@googlegroups.com
I found my problem. RHEDS uses SSHA whereas Google uses SHA-1, not the same thing. I ended up hashing and storing the password as SHA-1 so that I have it later when I create the Google account.
Reply all
Reply to author
Forward
0 new messages