Class AesGcmCryptoService

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

public class AesGcmCryptoService extends Object implements KeyReferenceCryptoService
  • Constructor Details

  • 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[] cryptoContainerBytes)
      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:
      cryptoContainerBytes - Encrypted data container, formatted according to a JeapCryptoDataFormat
      Returns:
      Decrypted plaintext bytes
    • getKeyReferenceForDecryption

      protected KeyReference getKeyReferenceForDecryption(EncryptedDataKey encryptedDataKey)
    • canDecrypt

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