AES icon indicating copy to clipboard operation
AES copied to clipboard

Introduce factory class

Open larshp opened this issue 9 years ago • 0 comments

Hi, Another idea, what do you think about introducing a factory class eg class ZCL_AES_FACTORY with 2 methods:

CREATE_MODE returns reference to ZIF_AES_MODE

  • would implement the functinoallity from ZCL_AES_UTILITY=>GET_AES_MODE

CREATE_PADDING returns reference to new interface ZIF_AES_PADDING

  • would implement the same as methods GET_BYTE_PADDING_UTILITY + VALIDATE_PADDING_STANDARD from ZCL_BYTE_PADDING_UTILITY, making it easy to change ZCL_BYTE_PADDING_UTILITY to an interface instead
  • and the singleton functionallity from ZCL_AES_UTILITY=>GET_PADDING_UTILITY

This would also change ENCRYPT_XSTRING so it takes a reference to ZIF_AES_MODE and ZIF_AES_PADDING instead of the constants.

Advantages:

  • The responsibility for creating objects are moved to a new class
  • ZCL_BYTE_PADDING_UTILITY is changed to an interface instead of a superclass, which will make it similar to ZIF_AES_MODE
  • ENCRYPT_XSTRING will take references to objects, which will make it easier to test new padding logic and modes

larshp avatar Dec 04 '16 14:12 larshp