aws-crt-cpp
include
aws
crt
crypto
HMAC.h
Go to the documentation of this file.
1
#pragma once
2
/*
3
* Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4
*
5
* Licensed under the Apache License, Version 2.0 (the "License").
6
* You may not use this file except in compliance with the License.
7
* A copy of the License is located at
8
*
9
* http://aws.amazon.com/apache2.0
10
*
11
* or in the "license" file accompanying this file. This file is distributed
12
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
13
* express or implied. See the License for the specific language governing
14
* permissions and limitations under the License.
15
*/
16
#include <
aws/crt/Exports.h
>
17
#include <
aws/crt/Types.h
>
18
19
struct
aws_hmac;
20
namespace
Aws
21
{
22
namespace
Crt
23
{
24
namespace
Crypto
25
{
26
static
const
size_t
SHA256_HMAC_DIGEST_SIZE = 32;
27
34
bool
AWS_CRT_CPP_API
ComputeSHA256HMAC
(
35
Allocator
*allocator,
36
const
ByteCursor
&secret,
37
const
ByteCursor
&input,
38
ByteBuf
&output,
39
size_t
truncateTo = 0) noexcept;
40
47
bool
AWS_CRT_CPP_API
ComputeSHA256HMAC
(
48
const
ByteCursor
&secret,
49
const
ByteCursor
&input,
50
ByteBuf
&output,
51
size_t
truncateTo = 0) noexcept;
57
class
AWS_CRT_CPP_API
HMAC
final
58
{
59
public
:
60
~
HMAC
();
61
HMAC
(
const
HMAC
&) =
delete
;
62
HMAC
&
operator=
(
const
HMAC
&) =
delete
;
63
HMAC
(
HMAC
&&toMove);
64
HMAC
&operator=(
HMAC
&&toMove);
65
69
inline
operator
bool() const noexcept {
return
m_good; }
70
74
inline
int
LastError
() const noexcept {
return
m_lastError; }
75
79
static
HMAC
CreateSHA256HMAC(
Allocator
*allocator,
const
ByteCursor
&secret) noexcept;
80
84
static
HMAC
CreateSHA256HMAC(
const
ByteCursor
&secret) noexcept;
85
90
bool
Update(
const
ByteCursor
&toHMAC) noexcept;
91
98
bool
Digest(
ByteBuf
&output,
size_t
truncateTo = 0) noexcept;
99
100
private:
101
HMAC
(aws_hmac *hmac) noexcept;
102
HMAC
() = delete;
103
104
aws_hmac *m_hmac;
105
bool
m_good;
106
int
m_lastError;
107
};
108
109
}
// namespace Crypto
110
}
// namespace Crt
111
}
// namespace Aws
Aws::Crt::Allocator
aws_allocator Allocator
Definition:
StlAllocator.h:25
Aws::Crt::Crypto::HMAC::HMAC
HMAC(const HMAC &)=delete
Types.h
AWS_CRT_CPP_API
#define AWS_CRT_CPP_API
Definition:
Exports.h:34
Aws::Crt::Crypto::HMAC::LastError
int LastError() const noexcept
Definition:
HMAC.h:74
Aws::Crt::ByteCursor
aws_byte_cursor ByteCursor
Definition:
Types.h:44
Aws::Crt::Crypto::ComputeSHA256HMAC
bool AWS_CRT_CPP_API ComputeSHA256HMAC(Allocator *allocator, const ByteCursor &secret, const ByteCursor &input, ByteBuf &output, size_t truncateTo=0) noexcept
Definition:
HMAC.cpp:25
Aws::Crt::ByteBuf
aws_byte_buf ByteBuf
Definition:
Types.h:43
Aws::Crt::Crypto::HMAC::operator=
HMAC & operator=(const HMAC &)=delete
Aws
Definition:
Api.h:25
Exports.h
Aws::Crt::Crypto::HMAC
Definition:
HMAC.h:58
Generated by
1.8.18