web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

The portal user's password encryption type

(0) ShareShare
ReportReport
Posted on by

I want to using plugin to automation create portal's login id and password after created an contact. But i don't know the encryption type.

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Nicholas Hayduk Profile Picture
    2,863 on at

    Hi Evan,

    The password isn't actually encrypted, it's hashed, and stored in the adx_identity_passwordhash field on the contact.  That one field contains both the hash and the salt needed to verify a password.

    The Portal uses ASP.NET Identity (v2) for local authentication, and so leverages its default password hashing functionality.

    This StackOverflow thread has more details on the password hashing:

    stackoverflow.com/.../asp-net-identity-default-password-hasher-how-does-it-work-and-is-it-secure

    If you're going to create the hash yourself, make sure you'll also creating a random security stamp (adx_identity_securitystamp) - authentication won't work if that field isn't set properly.  Typically it's set to a random GUID.

    Hope that helps.

    Nick

  • Suggested answer
    Justinjose Profile Picture
    2,707 on at

    I agree with Nicholas Hayduk

    If you dont want to develop ASP.NET Identity Password Hasher, then there is an alternative way you could to try by using existing CRM Portal functionality. Have a look on "Change Password" dialog in the Portal solution installed CRM. Which is used to change Portal password. Following are key element ( Custom Workflow) using to change password.

    Adxstudio.Xrm.Workflow.Identity (1.0.0.2):Adxstudio.Xrm.Workflow.Identity.ChangePassword 

    Adxstudio.Xrm.Workflow.Identity (1.0.0.2):Adxstudio.Xrm.Workflow.Identity.SetSecurityStamp

    Workaround

    1. Create a workflow using above custom workflow
    2. Using the plugin create portal login Id and Password.
    3. Send the password to above workflow.
    4. Workflow will add password into the contact form

    Thanks

    Justin Jose

  • Community Member Profile Picture
    on at

    Thank you Justin Jose and Nicholas Hayduk.

    I want to using Justin Jose's Workaround.

    I can find the processes "Change Password", But, I don't know how to using plugin to invoke  this processes.

    And, I will import lot's of members to contact, Does the processes support ?

  • Suggested answer
    Justinjose Profile Picture
    2,707 on at

    Hi Evan,

    Did you install CRM Portal? Its a Dialog called "Change Password".

    1. Create new workflow using following custom workflow. Have a look sample "Change Password" Dialog

    • Adxstudio.Xrm.Workflow.Identity (1.0.0.2):Adxstudio.Xrm.Workflow.Identity.ChangePassword
    • Adxstudio.Xrm.Workflow.Identity (1.0.0.2):Adxstudio.Xrm.Workflow.Identity.SetSecurityStamp

    2. Pass the password to the workflow using Action and Plugin.

    Or

    If you don,t want to set custom password, then you could use 'Redeem Invitation'. This can be configured on creation contact.

    Thanks

    Justin Jose

  • Community Member Profile Picture
    on at

    Hi Justin,

    I want to use plug in to monitor contact create by import members. When contact created, the plug in will automation generation an portal login id and password for it. Because of password is an hash value, So, I want to use the CRM change Password method(Because, I don't know, Is the password hash value replaced by others encryption in the future), So, I want to do in bellow:

    1. Using plug in to monitor contact create.

    2. Using Plug in invoke CRM "Change Password" processes(Settings --> Customization --> Customize the System --> Processes -->"Change Password").

    If the Plug in can not invoke CRM "Change Password" processes, Is there only one way to setting password hash value?

  • Community Member Profile Picture
    on at

    Hi Nicholas

    My code in below:

    [code]

    public string HashPasswordV2()
    {
    string password = textBox3.Text;//Password
    Guid securitystamp = new Guid(textBox1.Text);//Securitystamp 
    byte[] salt;
    byte[] buffer2;
    if (password == null)
    {
    throw new ArgumentNullException("password");
    }
    using (Rfc2898DeriveBytes bytes = new Rfc2898DeriveBytes(password, securitystamp.ToByteArray(), 0x3e8))
    {
    salt = bytes.Salt;
    buffer2 = bytes.GetBytes(0x20);
    }
    byte[] dst = new byte[0x31];
    Buffer.BlockCopy(salt, 0, dst, 1, 0x10);
    Buffer.BlockCopy(buffer2, 0, dst, 0x11, 0x20);
    return Convert.ToBase64String(dst);//Hash Value
    }

    [/code]

     

    I‘m test same as password and securitystamp as portal.
    But the hash value is not equal portal hash value, Could you help me to find out my mistake?

  • Suggested answer
    Justinjose Profile Picture
    2,707 on at

    Hi Evan,

    Please try below.

    1. Create an Action with a string input parameter and call it Password.

    2. Create step in the above Action using Adxstudio.Xrm.Workflow.Identity (1.0.0.2):Adxstudio.Xrm.Workflow.Identity.ChangePassword

    Adxstudio.Xrm.Workflow.Identity (1.0.0.2):Adxstudio.Xrm.Workflow.Identity.SetSecurityStamp

    3. Invoke Action using plugin

    4. Pass the password to Action

    Thanks

    Justin Jose

  • Community Member Profile Picture
    on at

    Hi Justin,

    I want to using this method to change password, But, How to set login id and password?

    private void CallingWorkflow(Guid entityId)

           {

               if (entityId == Guid.Empty) return;

               //Adxstudio.Xrm.Workflow.Identity.ChangePassword:3f4a37bf-d77a-4231-adb4-2e12630e44e3

               //Adxstudio.Xrm.Workflow.Identity.SetSecurityStamp:6ad91e81-104d-448d-88fd-b8a3ed832c4a

               ExecuteWorkflowRequest request = new ExecuteWorkflowRequest();

               request.WorkflowId = new Guid("6ad91e81-104d-448d-88fd-b8a3ed832c4a");

               request.EntityId = entityId;

               ExecuteWorkflowResponse response = service.Execute(request) as ExecuteWorkflowResponse;

               request.WorkflowId = new Guid("3f4a37bf-d77a-4231-adb4-2e12630e44e3");

               request.EntityId = entityId;

               request.Parameters.Add("Password", "");

               response = service.Execute(request) as ExecuteWorkflowResponse;

           }

  • Community Member Profile Picture
    on at

    Hi Nicholas,

    I'm not sure the adx_identity_securitystamp field is correct for password.

    Because, I'm changed the password value as same as old password value, the password was been changed,

    But the adx_identity_securitystamp  field value is not change.

  • Community Member Profile Picture
    on at

    Hi Justin,

    I'm create an workflow,  and add steps using Adxstudio.Xrm.Workflow.Identity (1.0.0.2):Adxstudio.Xrm.Workflow.Identity.ChangePassword

    Adxstudio.Xrm.Workflow.Identity (1.0.0.2):Adxstudio.Xrm.Workflow.Identity.SetSecurityStamp

    But I have another question:

    An error has occurred while trying to start the linked child dialog. The input arguments in the child dialog do not match those of the parent dialog. Contact your system administrator for help.


    7024.2018_2D00_06_2D00_13_5F00_171338.png

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans