Re-encrypting an Object
To encrypt and decrypt an object's data encryption keys with a different master encryption key, you can re-encrypt the object in Object Storage.
For more information, see Encrypting Data.
To re-encrypt an object, you need OBJECT_READ and OBJECT_OVERWRITE permissions. To re-encrypt an object that you encrypted with an SSE-C key, you must use the CLI to provide the SSE-C key to Object Storage for use during decryption and re-encryption, as appropriate.
If you receive an error, verify that you have the correct permissions. If you have access to the object, confirm that the object exists and has not recently been deleted. If you have permissions and the object exists, also confirm whether the object is encrypted with an SSE-C key. To re-encrypt an object that you encrypted with an SSE-C key, you must use the CLI to provide the SSE-C key to the Object Storage service for use during decryption and re-encryption, as appropriate.
- Tip
You need OBJECT_READ and OBJECT_OVERWRITE permissions to re-encrypt an object.You can re-encrypt the data encryption keys that encrypt an object. You can do so by re-encrypting the object's data encryption keys with the latest version of the master encryption key assigned to the bucket, whether it's an Oracle managed key or a key in a vault that you manage. You can also re-encrypt the object's data encryption keys with a different key in a vault or a different SSE-C key. If you use SSE-C keys, you must provide the SSE-C key during the object decryption and subsequent re-encryption process, as appropriate.
You can re-encrypt an object's data encryption keys with the latest key version of the key assigned to the bucket.
oci os object reencrypt --namespace <object_storage_namespace> --bucket-name <bucket_name> --name <object_name>
For example:
oci os object reencrypt --namespace MyNamespace --bucket-name MyBucket --name MyFile.txt
The object's data encryption keys are re-encrypted with no further information returned.
If the object's data encryption keys are currently encrypted with an SSE-C key, you must also provide the name of the file that contains the base64-encoded string of the AES-256 source encryption key to first decrypt the object.
oci os object reencrypt --namespace <object_storage_namespace> --bucket-name <bucket_name> --name <object_name> --source-encryption-key-file <name_of_file_containing_base64-encoded_AES-256_key>
For example:
oci os object reencrypt --namespace MyNamespace --bucket-name MyBucket --name MyFile.txt --source-encryption-key-file MySSE-CKey
You can re-encrypt an object's data encryption keys with a specific Vault key.
oci os object reencrypt --namespace <object_storage_namespace> --bucket-name <bucket_name> --name <object_name> --kms-key-id <key_OCID>
For example:
oci os object reencrypt --namespace MyNamespace --bucket-name MyBucket --name MyFile.txt --kms-key-id ocid1.key.region1.sea.exampleaaacu2.examplesmtpsuqmoy4m5cvblugmizcoeu2nfc6b3zfaux2lmqz245gezevsq
Again, if the key is currently encrypted with an SSE-C key, you must also provide the name of the file that contains the base64-encoded string of the AES-256 source encryption key to first decrypt the object.
oci os object reencrypt --namespace <object_storage_namespace> --bucket-name <bucket_name> --name <object_name> --source-encryption-key-file <name_of_file_containing_base64-encoded_AES-256_key> --kms-key-id <key_OCID>
For example:
oci os object reencrypt --namespace MyNamespace --bucket-name MyBucket --name MyFile.txt --source-encryption-key-file MySSE-CKey --kms-key-id ocid1.key.region1.sea.exampleaaacu2.examplesmtpsuqmoy4m5cvblugmizcoeu2nfc6b3zfaux2lmqz245gezevsq
You can re-encrypt an object's data encryption keys with an SSE-C key .
oci os object reencrypt --namespace <object_storage_namespace> --bucket-name <bucket_name> --name <object_name> --encryption-key-file <name_of_file_containing_base64-encoded_AES-256_key>
For example:
oci os object reencrypt --namespace MyNamespace --bucket-name MyBucket --name MyFile.txt --encryption-key-file MySSE-CKey
If the object is currently encrypted with an SSE-C key, and you want to encrypt the object's data encryption keys with a different SSE-C key, provide the file name of each key.
oci os object reencrypt --namespace <object_storage_namespace> --bucket-name <bucket_name> --name <object_name> --source-encryption-key-file <name_of_file_containing_base64-encoded_AES-256_key_currently_assigned> --encryption-key-file <name_of_file_containing_base64-encoded_AES-256_key_desired>
For example:
oci os object reencrypt --namespace MyNamespace --bucket-name MyBucket --name MyFile.txt --source-encryption-key-file MySSE-CKey --encryption-key-file MyNewSSE-CKey
For information about using the API and signing requests, see REST API documentation and Security Credentials. For information about SDKs, see SDKs and the CLI.
Object Storage prepends the Object Storage namespace string and bucket name to the object name when constructing a URL for use with the API:/n/<object_storage_namespace>/b/<bucket>/o/<object_name>
The object name is everything after the
/o/
, which could include hierarchy levels and prefix strings.Use the following API operations to manage objects:
ReencryptObject