Class AesGcmCryptoService
java.lang.Object
ch.admin.bit.jeap.crypto.internal.core.aes.AesGcmCryptoService
- All Implemented Interfaces:
KeyReferenceCryptoService
-
Constructor Summary
ConstructorsConstructorDescriptionAesGcmCryptoService(KeyManagementService keyManagementService, JeapCryptoDataFormat dataFormat) -
Method Summary
Modifier and TypeMethodDescriptionbooleancanDecrypt(byte[] ciphertext) byte[]decrypt(byte[] cryptoContainerBytes) Decrypts a jEAP crypto container back to the plaintext bytes.byte[]encrypt(byte[] plaintext, KeyReference wrappingKeyReference) Encrypts plaintext to a jEAP crypto container, using a data key for encryption of the data.protected KeyReferencegetKeyReferenceForDecryption(EncryptedDataKey encryptedDataKey)
-
Constructor Details
-
AesGcmCryptoService
public AesGcmCryptoService(KeyManagementService keyManagementService, JeapCryptoDataFormat dataFormat)
-
-
Method Details
-
encrypt
Description copied from interface:KeyReferenceCryptoServiceEncrypts plaintext to a jEAP crypto container, using a data key for encryption of the data.- Specified by:
encryptin interfaceKeyReferenceCryptoService- Parameters:
plaintext- Plaintext bytes to be encryptedwrappingKeyReference- Reference to a key managed by aKeyManagementService, 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:KeyReferenceCryptoServiceDecrypts 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:
decryptin interfaceKeyReferenceCryptoService- Parameters:
cryptoContainerBytes- Encrypted data container, formatted according to aJeapCryptoDataFormat- Returns:
- Decrypted plaintext bytes
-
getKeyReferenceForDecryption
-
canDecrypt
public boolean canDecrypt(byte[] ciphertext) - Specified by:
canDecryptin interfaceKeyReferenceCryptoService
-