AlexaClientSDK  1.26.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
PKCS11KeyDescriptor.h
Go to the documentation of this file.
1 /*
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
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  * A copy of the License is located at
7  *
8  * http://aws.amazon.com/apache2.0/
9  *
10  * or in the "license" file accompanying this file. This file is distributed
11  * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12  * express or implied. See the License for the specific language governing
13  * permissions and limitations under the License.
14  */
15 
16 #ifndef ACSDKPKCS11_PRIVATE_PKCS11KEYDESCRIPTOR_H_
17 #define ACSDKPKCS11_PRIVATE_PKCS11KEYDESCRIPTOR_H_
18 
19 #include <functional>
20 #include <string>
21 
24 
25 namespace alexaClientSDK {
26 namespace acsdkPkcs11 {
27 
40  std::string objectLabel;
41 
47  CK_KEY_TYPE keyType;
48 
52  CK_ULONG keyLen;
53 
59  PKCS11KeyDescriptor(PKCS11KeyDescriptor&& arg) noexcept = default;
60 
67  PKCS11KeyDescriptor(const std::string& objectLabel, acsdkCryptoInterfaces::AlgorithmType algorithmType) noexcept;
68 
76  PKCS11KeyDescriptor(const std::string& objectLabel, CK_KEY_TYPE keyType, CK_ULONG keyLen) noexcept;
77 
87  static bool mapAlgorithmToKeyParams(
89  CK_KEY_TYPE& keyType,
90  CK_ULONG& keyLen);
91 };
92 
93 } // namespace acsdkPkcs11
94 } // namespace alexaClientSDK
95 
96 namespace std {
97 
101 template <>
102 struct hash<alexaClientSDK::acsdkPkcs11::PKCS11KeyDescriptor> {
110  std::size_t operator()(const alexaClientSDK::acsdkPkcs11::PKCS11KeyDescriptor& arg) const noexcept;
111 };
112 
116 template <>
117 struct equal_to<alexaClientSDK::acsdkPkcs11::PKCS11KeyDescriptor> {
126  bool operator()(
128  const alexaClientSDK::acsdkPkcs11::PKCS11KeyDescriptor& arg2) const noexcept;
129 };
130 
131 // Dumps PKCS11KeyDescriptor data into stream (for logging).
132 std::ostream& operator<<(std::ostream& out, const alexaClientSDK::acsdkPkcs11::PKCS11KeyDescriptor& arg) noexcept;
133 
134 } // namespace std
135 
136 #endif // ACSDKPKCS11_PRIVATE_PKCS11KEYDESCRIPTOR_H_
alexaClientSDK::acsdkPkcs11::PKCS11KeyDescriptor::keyLen
CK_ULONG keyLen
Key length in bytes.
Definition: PKCS11KeyDescriptor.h:52
AlgorithmType.h
alexaClientSDK::acsdkPkcs11::PKCS11KeyDescriptor::keyType
CK_KEY_TYPE keyType
Key object type.
Definition: PKCS11KeyDescriptor.h:47
alexaClientSDK::acsdkPkcs11::PKCS11KeyDescriptor::mapAlgorithmToKeyParams
static bool mapAlgorithmToKeyParams(acsdkCryptoInterfaces::AlgorithmType algorithmType, CK_KEY_TYPE &keyType, CK_ULONG &keyLen)
Maps algorithm type into key type and length.
Definition: PKCS11KeyDescriptor.cpp:32
alexaClientSDK::acsdkPkcs11::PKCS11KeyDescriptor
Class to identify key object in HSM.
Definition: PKCS11KeyDescriptor.h:36
alexaClientSDK::acsdkPkcs11::PKCS11KeyDescriptor::PKCS11KeyDescriptor
PKCS11KeyDescriptor(PKCS11KeyDescriptor &&arg) noexcept=default
Default move constructor.
alexaClientSDK
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36
PKCS11API.h
alexaClientSDK::acsdkPkcs11::PKCS11KeyDescriptor::objectLabel
std::string objectLabel
Key object label.
Definition: PKCS11KeyDescriptor.h:40
std
Definition: CapabilityConfiguration.h:190
alexaClientSDK::acsdkCryptoInterfaces::AlgorithmType
AlgorithmType
Enumeration of all supported encryption protocols.
Definition: AlgorithmType.h:31

AlexaClientSDK 1.26.0 - Copyright 2016-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0