-
- All Implemented Interfaces:
-
com.uid2.network.DataEnvelope
public class DataEnvelope.Default implements DataEnvelope
-
-
Field Summary
Fields Modifier and Type Field Description public final static DataEnvelope.DefaultINSTANCE
-
Method Summary
Modifier and Type Method Description ByteArrayencrypt(SecretKey key, String data, ByteArray iv, ByteArray aad)Encrypts the given data with the provided key. ByteArraydecrypt(String key, String data, Boolean includesNonce)Decrypts the given data with the provided key. ByteArraydecrypt(ByteArray key, String data, Boolean includesNonce)Decrypts the given data with the provided key. -
-
Method Detail
-
encrypt
ByteArray encrypt(SecretKey key, String data, ByteArray iv, ByteArray aad)
Encrypts the given data with the provided key.
- Parameters:
key- The key, as represented by a SecretKey, required to encrypt the given data.data- The data to encrypt.iv- The initialization vector.aad- Any additional authentication data.
-
decrypt
ByteArray decrypt(String key, String data, Boolean includesNonce)
Decrypts the given data with the provided key.
This relies on the format of the data matching that spec-ed in the API documentation. We assume that it's AES encrypted, and includes the IV in the first 12 bytes of the buffer.
- Parameters:
key- The key, in Base64 format, required to decode the given data.data- The data, in Base64 format, that needs to be decoded.includesNonce- If a nonce (and timestamp) is expected in the decrypted data.
-
decrypt
ByteArray decrypt(ByteArray key, String data, Boolean includesNonce)
Decrypts the given data with the provided key.
This relies on the format of the data matching that spec-ed in the API documentation. We assume that it's AES encrypted, and includes the IV in the first 12 bytes of the buffer.
- Parameters:
key- The key, in bytes, required to decode the given data.data- The data, in Base64 format, that needs to be decoded.includesNonce- If a nonce (and timestamp) is expected in the decrypted data.
-
-
-
-