@InterfaceAudience.Private @InterfaceStability.Evolving public final class CSEUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static CSEMaterials |
getClientSideEncryptionMaterials(org.apache.hadoop.conf.Configuration conf,
String bucket,
S3AEncryptionMethods algorithm)
Creates encryption materials for client-side encryption based on the specified algorithm.
|
static long |
getUnencryptedObjectLength(S3AStore store,
String key,
long contentLength,
software.amazon.awssdk.services.s3.model.HeadObjectResponse headObjectResponse)
Determines the actual unencrypted length of an S3 object.
|
static boolean |
isCSEEnabled(String encryptionMethod)
Checks if Client-Side Encryption (CSE) is enabled based on the encryption method.
|
static boolean |
isObjectEncrypted(S3AStore store,
String key)
Checks if an S3 object is encrypted by examining its metadata.
|
public static boolean isCSEEnabled(String encryptionMethod)
encryptionMethod - The encryption method to check (case-sensitive)S3AEncryptionMethods.CSE_KMS,
S3AEncryptionMethods.CSE_CUSTOMpublic static boolean isObjectEncrypted(S3AStore store, String key) throws IOException
store - The S3AStore instance used to access the S3 objectkey - The key (path) of the S3 object to checkIOException - If there's an error accessing the object metadata or
communicating with S3public static long getUnencryptedObjectLength(S3AStore store, String key, long contentLength, software.amazon.awssdk.services.s3.model.HeadObjectResponse headObjectResponse) throws IOException
store - The S3AStore instance used to access the S3 objectkey - The key (path) of the S3 objectcontentLength - The encrypted object's content lengthheadObjectResponse - The object's metadata from a HEAD request, may be nullIOException - If there's an error:
- accessing the object or its metadata
- parsing the unencrypted length from metadata
- performing the ranged GET operation
- computing the unencrypted lengthpublic static CSEMaterials getClientSideEncryptionMaterials(org.apache.hadoop.conf.Configuration conf, String bucket, S3AEncryptionMethods algorithm) throws IOException
conf - The configuration containing encryption settingsbucket - The S3 bucket name for which encryption materials are being createdalgorithm - The encryption algorithm to use (CSE_KMS or CSE_CUSTOM)IOException - If there's an error retrieving encryption configurationIllegalArgumentException - If:
- KMS key ID is null or empty (for CSE_KMS)
- Custom crypto class name is null or empty (for CSE_CUSTOM)
- Unsupported encryption algorithm is specifiedCopyright © 2008–2025 Apache Software Foundation. All rights reserved.