You need to obtain the private key file from Oracle Cloud Infrastructure. This file will be used to sign the requests.
The signing string is a combination of the HTTP method, request headers, and the request target.
http_method="GET" # or POST, depending on your request
request_target="/20160918/instances/"
host="objectstorage.us-phoenix-1.oraclecloud.com"
date=$(date -u "+%a, %d %h %Y %H:%M:%S GMT")
signing_string="(request-target): ${http_method,,} ${request_target}\nhost: $host\ndate: $date"
Use OpenSSL to sign the signing string with your private key and encode it in base64:
signature=$(printf '%b' "$signing_string" | openssl dgst -sha256 -sign /path/to/your/private_key.pem | openssl enc -e -base64 | tr -d '\n')
The authorization header includes the signature and other required details like the key ID and algorithm.
key_id="ocid1.tenancy.oc1..your-unique-key-id"
auth_header="Signature version=\"1\",keyId=\"$key_id\",algorithm=\"rsa-sha256\",headers=\"(request-target) host date\",signature=\"$signature\""
You can use Azure Synapse Pipeline Web Activity to make HTTP requests where you add headers for Authorization
, Date
, and Host
.
{
"Authorization": "Signature version=\"1\",keyId=\"ocid1.tenancy.oc1..your-unique-key-id\",algorithm=\"rsa-sha256\",headers=\"(request-target) host date\",signature=\"$signature\"",
"Date": "Thu, 04 Jul 2024 14:27:00 GMT",
"Host": "objectstorage.us-phoenix-1.oraclecloud.com"
}
Then set the URL to the OCI endpoint you want to interact with and configure the method (GET or POST) as required (you can pass any additional required parameters)