Jump to:

23491 Posts in 18996 Topics by 2878 members

General Questions

SilverStripe Forums » General Questions » How to change password encryption/decryption algorithm

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 1915 Views
  • MartinElkj√¶r
    Avatar
    Community Member
    2 Posts

    How to change password encryption/decryption algorithm Link to this post

    Hi,

    I'm migrating a lot of users (2200+) to SS from another system. The passwords for all the users are encrypted using the Blowfish algorithm (using java and BCrypt )

    My question is: How can I tell SS to use this algorithm ??
    I've been looking at the _config.php in sapphire and my gues is that I need to register at new password encryptor with "PasswordEncryptor::register" ??

    Any help ?

    Best Regards,
    Martin

  • Pigeon
    Avatar
    Community Member
    243 Posts

    Re: How to change password encryption/decryption algorithm Link to this post

    Great question!

    This page can help with regards to the basic concept, but to understand how to use your own custom encryption requires digging a bit deeper into how SilverStripe works.

    First, you need to start by creating your "encryptor" class in mysite/code/. See the in-built password encryptor for SS to give you a base to work from. You want to create a class like so:

    class MyEncryptor extends PasswordEncryptor {
    ..
    }

    You should be able to define your encryption algorithm in there.

    You then need to register your encryptor and then assign it to be used. Something like this in your mysite/_config.php:

    ...
    PasswordEncryptor::register('blowfish','MyEncryptor');
    Security::set_password_encryption_algorithm('blowfish');
    ...

    Then you should be good to go!

    Hope that helps you out.

    1915 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.