Skip to content
wilrikdeloose edited this page Apr 24, 2018 · 8 revisions

Welcome the documentation of this Java example for encrypting and hashing passwords.

Software architecture

To get a better overview of the code structure the architecture depicted below was made. It shows all the used packages and the dependencies.

Architecture (see for fullscreen)

Software design

In the sections on this page you get an overview of the most important part of the software design.

Overall class diagram

Below you will find the class diagram of this example. As you can see it is a console application. A 3-tier architecture however is implemented so that you can use the logic in the BLL-package to easily integrate it in your own application.

You can request a specific encryptor implementation from the EncrypterFactory class through the static method getEncrypter(EncryptionAlgorithm) which returns the specified PasswordEncrypter.

Class diagram (see full screen)

Sequence diagram app startup

In the following sequence diagram you can see how the encryption algorithm that is used is fetched and by which class. When the AccountRepository is instantiated, its constructor will get the algorithm that will be used for login and registering accounts.

Sequence diagram app startup (see full screen)

Sequence diagram account login

The next sequence diagram shows the login procedure. From this diagram you can see that the AccountRepository first needs to fetch the salt for the user. With the salt, and the given username, the AccountRepository then checks with the AccountContext whether or not the credentials are correct.

Sequence diagram account login (see full screen)