diff --git a/cpp/src/arrow/filesystem/filesystem_test.cc b/cpp/src/arrow/filesystem/filesystem_test.cc index 845c82a79edd5..df21d88e41c6d 100644 --- a/cpp/src/arrow/filesystem/filesystem_test.cc +++ b/cpp/src/arrow/filesystem/filesystem_test.cc @@ -59,7 +59,7 @@ TEST(CalculateSSECKeyMD5, Sanity) { ASSERT_FALSE(CalculateSSECKeyMD5("", lResult)); // invalid base64 ASSERT_FALSE(CalculateSSECKeyMD5("%^H", lResult)); // invalid base64 ASSERT_FALSE(CalculateSSECKeyMD5("INVALID", lResult)); // invalid base64 - ASSERT_FALSE(CalculateSSECKeyMD5("MTIzNDU2Nzg5", lResult)); // not, match 32 bytes + ASSERT_FALSE(CalculateSSECKeyMD5("MTIzNDU2Nzg5", lResult)); // invalid, the input key size not match ASSERT_TRUE(CalculateSSECKeyMD5("1WH9aTJ0+Tn0NLbTMHZn9aCW3Li3ViAdBsoIldPCREw=", lResult)); // valid case } diff --git a/cpp/src/arrow/filesystem/util_internal.h b/cpp/src/arrow/filesystem/util_internal.h index 30402e28ae207..a9eef51607593 100644 --- a/cpp/src/arrow/filesystem/util_internal.h +++ b/cpp/src/arrow/filesystem/util_internal.h @@ -99,7 +99,12 @@ ARROW_EXPORT Result GlobFiles(const std::shared_ptr& filesystem, const std::string& glob); - +/// \brief Decode the Input SSE key,calculate the MD5 +/// \param base64_encoded_key is the input base64 encoded sse key +/// \param md5_result, output resut +/// \param expect_input_key_size, default 32 +/// \return true if the decode and calculate MD5 success, otherwise return false +ARROW_EXPORT bool CalculateSSECKeyMD5(const std::string& base64_encoded_key, std::string& md5_result, int expect_input_key_size = 32);