Class MAMDataProtectionManager
-
- All Implemented Interfaces:
public final class MAMDataProtectionManagerData protection management facilities. Apps which make use of this class should implement a receiver for the MANAGEMENT_REMOVED notification. After return from handling this notification, buffers which were protected via this class will no longer be readable if file encryption was enabled when the buffers were protected. An app can remediate this situation by calling MAMDataProtectionManager.unprotect on all buffers during this notification. Note that it is also safe to call protect during this notification if it is desired to preserve identity information -- encryption is guaranteed to be disabled during the notification.
-
-
Method Summary
Modifier and Type Method Description static InputStreamprotect(@NonNull() InputStream input, String identity)Protect a stream. static InputStreamprotectForOID(@NonNull() InputStream input, String oid)Protect a stream. static Array<byte>protect(@NonNull() Array<byte> input, String identity)Protect a byte array. static Array<byte>protectForOID(@NonNull() Array<byte> input, String oid)Protect a byte array. static InputStreamunprotect(@NonNull() InputStream input)Unprotect a stream. static Array<byte>unprotect(@NonNull() Array<byte> input)Unprotect a byte array. static MAMDataProtectionInfogetProtectionInfo(@NonNull() InputStream input)Get the protection info on a stream. static MAMDataProtectionInfogetProtectionInfo(@NonNull() Array<byte> input)Get the protection info on a byte array. static booleanisBackupAllowed(@NonNull() Array<byte> input)Determines if the given data buffer is allowed to be backed up. static booleanisBackupAllowed(@NonNull() InputStream input)Determines if the given data buffer is allowed to be backed up. -
-
Method Detail
-
protect
@Deprecated()@NonNull() static InputStream protect(@NonNull() InputStream input, String identity)
Protect a stream. This will return a stream containing the protected input.
- Parameters:
input- Input data to protect, read sequentially.identity- UPN of identity to set.- Returns:
Protected input data.
-
protectForOID
@NonNull() static InputStream protectForOID(@NonNull() InputStream input, String oid)
Protect a stream. This will return a stream containing the protected input.
- Parameters:
input- Input data to protect, read sequentially.oid- AAD OID of identity to set.- Returns:
Protected input data.
-
protect
@Deprecated()@NonNull() static Array<byte> protect(@NonNull() Array<byte> input, String identity)
Protect a byte array. This will return protected bytes.
- Parameters:
input- Input data to protect.identity- UPN of identity to set.- Returns:
Protected input data.
-
protectForOID
@NonNull() static Array<byte> protectForOID(@NonNull() Array<byte> input, String oid)
Protect a byte array. This will return protected bytes.
- Parameters:
input- Input data to protect.oid- AAD OID of identity to set.- Returns:
Protected input data.
-
unprotect
@NonNull() static InputStream unprotect(@NonNull() InputStream input)
Unprotect a stream. This will return a stream containing the unprotected input. If the data was not protected to begin with, returns a stream with the original data.
- Parameters:
input- Input data to protect, read sequentially.- Returns:
Protected input data.
-
unprotect
@NonNull() static Array<byte> unprotect(@NonNull() Array<byte> input)
Unprotect a byte array. This will return unprotected bytes. If the data was not protected to begin with, returns the original data.
- Parameters:
input- Input data to protect.- Returns:
Unprotected data
-
getProtectionInfo
@Nullable() static MAMDataProtectionInfo getProtectionInfo(@NonNull() InputStream input)
Get the protection info on a stream.
- Parameters:
input- Input stream to get information on.- Returns:
Data protection info, or null if there is no protection info.
-
getProtectionInfo
@Nullable() static MAMDataProtectionInfo getProtectionInfo(@NonNull() Array<byte> input)
Get the protection info on a byte array.
- Parameters:
input- Input bytes to get information on.- Returns:
Data protection info, or null if there is no protection info.
-
isBackupAllowed
static boolean isBackupAllowed(@NonNull() Array<byte> input)
Determines if the given data buffer is allowed to be backed up.
- Parameters:
input- the byte[] data buffer.- Returns:
true if the buffer can be backed up, false if not.
-
isBackupAllowed
static boolean isBackupAllowed(@NonNull() InputStream input)
Determines if the given data buffer is allowed to be backed up.
- Parameters:
input- the InputStream data buffer.- Returns:
true if the buffer can be backed up, false if not.
-
-
-
-