I am trying to write and read binary data from DynamoDB using SDK php 2.
I can write the data to the table but when I read it, it comes in a different format how to cast it back to its original binary format.
$put_response = $dynamodb->putItem(array(
'TableName' => 'TableName',
'Item' => array(
'Id' => array( 'S' => 'werwer' ), // Primary Key
'IV' => array( 'B' => openssl_random_pseudo_bytes(50)),
'Password' => array( 'B' => $encrypt->EncryptER("asdasd") )
)
));
When I read the IV attribute or the Password I get a different value for it, what is the cast that I should do or if there is a function to convert the string back to binary.
This is what I get if I do echo before storing the value in Dynamo LX x ʝ t] >0
This is the echo of the variable after reading it from Dynamo GdNMWLt4nZrKnc50XdE+MA==
Thanks
The main thing was that the binary data is stored in base64 in DynamoDB even if you provided it in raw format. so to get the raw binary back I had to use
base64_decode($response->getPath('Item/IV/B'))
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.