Class NoopKeyIdCryptoService

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

public class NoopKeyIdCryptoService extends Object implements KeyIdCryptoService
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

    • NoopKeyIdCryptoService

      public NoopKeyIdCryptoService(Set<String> knownKeyIds)
  • Method Details

    • encrypt

      public byte[] encrypt(byte[] plaintext, KeyId keyId)
      Description copied from interface: KeyIdCryptoService
      Encrypts plaintext to a jEAP crypto container, using the wrapping key identified by the given key id for the encryption of the data.
      Specified by:
      encrypt in interface KeyIdCryptoService
      Parameters:
      plaintext - Plaintext bytes to be encrypted
      keyId - Identifier for the wrapping key to be used for the encryption
      Returns:
      Encrypted data container, formatted according to a JeapCryptoDataFormat
    • decrypt

      public byte[] decrypt(byte[] ciphertextCryptoContainer)
      Description copied from interface: KeyIdCryptoService
      Decrypts a jEAP crypto container back to the plaintext bytes.
      Specified by:
      decrypt in interface KeyIdCryptoService
      Parameters:
      ciphertextCryptoContainer - Encrypted data container, formatted according to a JeapCryptoDataFormat
      Returns:
      Decrypted plaintext bytes
    • configuredKeyIds

      public Set<KeyId> configuredKeyIds()
      Specified by:
      configuredKeyIds in interface KeyIdCryptoService
    • canDecrypt

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