Class NoopKeyReferenceCryptoService

java.lang.Object
ch.admin.bit.jeap.crypto.internal.core.noop.NoopKeyReferenceCryptoService
All Implemented Interfaces:
KeyReferenceCryptoService

public class NoopKeyReferenceCryptoService extends Object implements KeyReferenceCryptoService
Should only be used to bypass encryption and decryption in dev environments. Hence, plaintext and ciphertext are returned untouched. No encryption or decryption is performed.
  • Constructor Details

    • NoopKeyReferenceCryptoService

      public NoopKeyReferenceCryptoService()
  • Method Details

    • encrypt

      public byte[] encrypt(byte[] plaintext, KeyReference wrappingKeyReference)
      Description copied from interface: KeyReferenceCryptoService
      Encrypts plaintext to a jEAP crypto container, using a data key for encryption of the data.
      Specified by:
      encrypt in interface KeyReferenceCryptoService
      Parameters:
      plaintext - Plaintext bytes to be encrypted
      wrappingKeyReference - Reference to a key managed by a KeyManagementService, which is used for generating data keys
      Returns:
      Encrypted data container, formatted according to a JeapCryptoDataFormat
    • decrypt

      public byte[] decrypt(byte[] ciphertextCryptoContainer)
      Description copied from interface: KeyReferenceCryptoService
      Decrypts a jEAP crypto container back to the plaintext bytes. The crypto container must contain a reference to the data key's wrapping key, i.e. key name/location.
      Specified by:
      decrypt in interface KeyReferenceCryptoService
      Parameters:
      ciphertextCryptoContainer - Encrypted data container, formatted according to a JeapCryptoDataFormat
      Returns:
      Decrypted plaintext bytes
    • canDecrypt

      public boolean canDecrypt(byte[] ciphertext)
      Specified by:
      canDecrypt in interface KeyReferenceCryptoService