Decrypting Data
Learn how to decrypt data with a master encryption key using either the CLI or API. Note that this operation can't be performed in the OCI Console.
This task isn't available in the OCI Console.
- Note
You can use either AES symmetric keys or RSA asymmetric keys to encrypt or decrypt data. ECDSA keys don't support vault cryptography required to encrypt or decrypt data. To decrypt data by using an RSA asymmetric key, if the key has been rotated and has a key version identifier, you must also provide the--key-version-idof the key. To decrypt the data, you must provide the same--key-version-id. The need to track key versions exists because, unlike symmetric keys, an asymmetric key's ciphertext doesn't contain the information that the service needs for decryption purposes.Open a command prompt and run oci kms crypto decrypt to decrypt data.
RSA keys: Note that the
--encryption-algorithmparameter must be included in the command for RSA keys. To decrypt data with an RSA key, use the following command. If you haven't rotated the key, you don't need the--key-version-idflag:oci kms crypto decrypt --key-id <key_OCID> --key-version-id <key_version_OCID> --ciphertext <ciphertext> --endpoint <cryptographic_endpoint> --encryption-algorithm <encryption_algorithm> --endpoint <crypto_data_plane_url>AES keys: To decrypt data with an AES key, use the following command:
oci kms crypto decrypt --key-id <key_OCID> --ciphertext <ciphertext> --endpoint --endpoint <cryptographic_endpoint>For a complete list of parameters and values for CLI commands, see the CLI Command Reference.
Use the Decrypt API with the Cryptographic Endpoint to decrypt data.
Note
The Management Endpoint is used for management operations including Create, Update, List, Get, and Delete. The Management Endpoint is also called the control plane URL or the KMSMANAGEMENT endpoint.
The Cryptographic Endpoint is used for cryptographic operations including Encrypt, Decrypt, Generate Data Encryption Key, Sign, and Verify. The Cryptographic Endpoint is also called the data plane URL or the KMSCRYPTO endpoint.
You can find the management and cryptographic endpoints in a vault's details metadata. See Getting a Vault's Details for instructions.
For regional endpoints for the Key Management, Secret Management, and Secret Retrieval APIs, see API Reference and Endpoints.
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.