MinIO C++ SDK
signer.h
1 // MinIO C++ Library for Amazon S3 Compatible Cloud Storage
2 // Copyright 2022 MinIO, Inc.
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 
16 #ifndef _MINIO_SIGNER_H
17 #define _MINIO_SIGNER_H
18 
19 #include <openssl/hmac.h>
20 
21 #include "http.h"
22 
23 namespace minio {
24 namespace signer {
25 std::string GetScope(utils::Time& time, std::string_view region,
26  std::string_view service_name);
27 std::string GetCanonicalRequestHash(std::string_view method,
28  std::string_view uri,
29  std::string_view query_string,
30  std::string_view headers,
31  std::string_view signed_headers,
32  std::string_view content_sha256);
33 std::string GetStringToSign(utils::Time& date, std::string_view scope,
34  std::string_view canonical_request_hash);
35 std::string HmacHash(std::string_view key, std::string_view data);
36 std::string GetSigningKey(std::string_view secret_key, utils::Time& date,
37  std::string_view region,
38  std::string_view service_name);
39 std::string GetSignature(std::string_view signing_key,
40  std::string_view string_to_sign);
41 std::string GetAuthorization(std::string_view access_key,
42  std::string_view scope,
43  std::string_view signed_headers,
44  std::string_view signature);
45 utils::Multimap& SignV4(std::string_view service_name, http::Method& method,
46  std::string_view uri, std::string_view region,
47  utils::Multimap& headers, utils::Multimap& query_params,
48  std::string_view access_key,
49  std::string_view secret_key,
50  std::string_view content_sha256, utils::Time& date);
51 utils::Multimap& SignV4S3(http::Method& method, std::string_view uri,
52  std::string_view region, utils::Multimap& headers,
53  utils::Multimap& query_params,
54  std::string_view access_key,
55  std::string_view secret_key,
56  std::string_view content_sha256, utils::Time& date);
57 utils::Multimap& SignV4STS(http::Method& method, std::string_view uri,
58  std::string_view region, utils::Multimap& headers,
59  utils::Multimap& query_params,
60  std::string_view access_key,
61  std::string_view secret_key,
62  std::string_view content_sha256, utils::Time& date);
63 } // namespace signer
64 } // namespace minio
65 #endif // #ifndef __MINIO_SIGNER_H