Options
All
  • Public
  • Public/Protected
  • All
Menu
description

The main service for handling encryption and decryption of data across the app modules.

since

v0.4.0

Hierarchy

  • CipherService

Index

Constructors

Methods

Constructors

Methods

  • decrypt(ciphertext: string, password: string): string
  • This method executes decryption of data using the *PBKDF2 encryption algorithm as implemented in crypto-js. It uses an 256-bits key size and executes 1024 iterations to produce the key. Additionally, it uses a random salt of 16 bytes. The underlying encryption key is passed on to the AES algorithm to perform decryption.

    Note that this method accepts a ciphertext as produced by the above CipherService.encrypt method, as such it expects a random salt and IV to be prepended to the ciphertext.

    access

    public

    Parameters

    • ciphertext: string

      The data that must be decrypted.

    • password: string

      The password used to generate the decryption key (PBKDF2).

    Returns string

    The decrypted ciphertext with the starting 32-bytes that consist of the salt and IV.

  • encrypt(data: string, password: string): string
  • This method executes encryption of data using the *PBKDF2 encryption algorithm as implemented in crypto-js. It uses an 256-bits key size and executes 1024 iterations to produce the key. Additionally, it uses a random salt of 16 bytes. The underlying encryption key is passed on to the AES algorithm to perform encryption.

    The resulting string is a ciphertext that starts with the random salt (16 bytes), is followed by the input vector (16 bytes) and ends with the encrypted data, i.e. the starting 32-bytes are used to decrypt the encrypted message.

    access

    public

    Parameters

    • data: string

      The data that must be encrypted.

    • password: string

      The password used to generate an encryption key (PBKDF2).

    Returns string

    The encrypted ciphertext with the starting 32-bytes that consist of the salt and IV.

Generated using TypeDoc