olp-cpp-sdk 1.24.0
Loading...
Searching...
No Matches
Crypto.h
1/*
2 * Copyright (C) 2019-2020 HERE Europe B.V.
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 * SPDX-License-Identifier: Apache-2.0
17 * License-Filename: LICENSE
18 */
19
20#pragma once
21
22#include <array>
23#include <string>
24#include <vector>
25
26#include <olp/authentication/AuthenticationApi.h>
27
28namespace olp {
29namespace authentication {
30
32class AUTHENTICATION_API Crypto {
33 public:
35 static const size_t Sha256DigestLength = 32;
36
38 using Sha256Digest = std::array<unsigned char, Sha256DigestLength>;
39
48 static Sha256Digest Sha256(const std::vector<unsigned char>& content);
49
58 static Sha256Digest HmacSha256(const std::string& key,
59 const std::string& message);
60};
61
62} // namespace authentication
63} // namespace olp
The cryptographic algoritms used by the library.
Definition Crypto.h:32
std::array< unsigned char, Sha256DigestLength > Sha256Digest
An alias for the hash.
Definition Crypto.h:38
static Sha256Digest Sha256(const std::vector< unsigned char > &content)
Sha256 cryptographic function used to compute the hash value for a buffer.
static Sha256Digest HmacSha256(const std::string &key, const std::string &message)
HMAC function based on SHA-256 hash function.
Rules all the other namespaces.
Definition AppleSignInProperties.h:24