Decrypts data using a CMK.
amazonkms.decrypt(keyId, algorithm, [callback])
The 'callback' parameter specifies a function which will be called when the operation completes (or an error is encountered). If the 'callback' parameter is not specified, then the method will block and will not return until the operation completes (or an error is encountered).
The callback for this method is defined as:
'err' is the error that occurred. If there was no error, then 'err' is 'null'.
'err' has 2 properties which hold detailed information:
This method decrypts data using the CMK specified by KeyId and the given Algorithm. The data to decrypt is taken from the the specified InputFile or the InputData property. The decrypted data is output to the the specified OutputFile or the OutputData property.
The value passed for the KeyId parameter must be the Id or ARN of a CMK, or the name or ARN of an alias, in the current Region. If an ARN is provided, it can be for a CMK or alias in another account so long as the appropriate permissions are in place.
The Algorithm parameter specifies which algorithm to use to decrypt the data; it must match the algorithm used to encrypt the data previously. Possible values vary depending on the specified CMK's key spec:
|CMK's Key Spec||Valid Algorithms|
|SYMMETRIC_DEFAULT||SYMMETRIC_DEFAULT (default if empty)|
If Algorithm is SYMMETRIC_DEFAULT, the encryption context items in the EncryptionContext* properties will be included in the request. Keep in mind that in order to successfully decrypt the data, the exact same encryption context items that were present when the data was encrypted must be supplied again. Encryption context items are case-sensitive, but not order-sensitive.
This method will fail if any of the following are true regarding the specified CMK: